There was a problem loading the comments.

Could not access 'CDO.Message'

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
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)


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net