•   19 August 2006 6:08 am
  •  

If you are getting "Could not access 'CDO.Message' Object when trying to send email using ASP.NET (System.Web.Mail)! Please see below to solve this problem?

Our mail servers require authentication to send emails throught.
In order to send emails use the following code:'------------------
'VB.NET
'------------------

oMsg.From = "from@from.com"

oMsg.To = "to@to.com"

oMsg.Subject = "subject here"

oMsg.BodyFormat = Web.Mail.MailFormat.Html

oMsg.Body = "Body here"

Dim oMsg As New Web.Mail.MailMessage'---authentication

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ip or mail.domain.name"

'or localhost

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'whether you use authentication on the server

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youremail-in-the-same-server"

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass-of-that-email"

oMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

'-----

Web.Mail.SmtpMail.SmtpServer = "ip or mail.domain.name"

'or localhost

Web.Mail.SmtpMail.Send(oMsg)


Comments

  Add Comment

Confirm Submission

Please enter the text from the image in the box provided; this helps us to prevent spam.