Could not access 'CDO.Message'
Posted by Bill Williams, Last modified by on 19 August 2006 01:08 PM
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)

(455 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).