I am trying to send an email from an ASP.NET application and get the error "Could not create 'CDO.Message' object"
It seems to be some permission error and unfortunately cannot figure it out, hence this post. I tested the same code in a VB.NET application and it works fine and sends the email. The error occurs in the ASP.NET page.
Below is the code that I am using to send the email, and I have also imported the System.Web.Mail class
Dim myMail As New MailMessage
myMail.From = "[EMAIL="mymails@abc.com"]mymails@abc.com[/EMAIL]"
myMail.To = "[EMAIL="artee@abc.com"]artee@abc.com[/EMAIL]"
myMail.Subject = "this is a test email."
myMail.Body = "Some text goes here"
SmtpMail.SmtpServer = "localhost"
Try
SmtpMail.Send(myMail)
Catch ex As Exception
Response.Write(("The following exception occurred: " + ex.ToString()))
'check the InnerException
While Not (ex.InnerException Is Nothing)
Response.Write("--------------------------------")
Response.Write(("The following InnerException reported: " + ex.InnerException.ToString()))
ex = ex.InnerException
End While
End Try
The Error displayed on the ASPX page is as below
'**********************************
The following exception occurred: System.Web.HttpException: Could not create 'CDO.Message' object. at System.Web.Mail.LateBoundAccessHelper.get_LateBoundType() at System.Web.Mail.LateBoundAccessHelper.CreateInstance() at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at TestEmails.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\TestEmails\MainPage.aspx.vb:line 40
'**********************************
Can you please help. I have been struggling with this the past couple of days trying to set permissions and registering the cdosys.dll, but nothing seems to work
Thanks
- Artee