| | |
Could not create 'CDO.Message' object
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 8
Reputation:
Solved Threads: 0
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
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
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
ASP.NET Syntax (Toggle Plain Text)
Dim myMail As New MailMessage myMail.From = "<a href="mailto:mymails@abc.com">mymails@abc.com</a>" myMail.To = "<a href="mailto:artee@abc.com">artee@abc.com</a>" 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
Last edited by artee; Mar 26th, 2007 at 3:31 pm. Reason: update
•
•
Join Date: Jan 2006
Posts: 275
Reputation:
Solved Threads: 11
do you have a mail server on your local machine? you are calling the smtp server on localhost but i suspect the service isnt installed and running. use a known smtp server. then add .net credentials to the smtpmail.
I would also use the system.net.mail namespace rather than the old smtp namespace if you have .net 2 on your pc
I would also use the system.net.mail namespace rather than the old smtp namespace if you have .net 2 on your pc
•
•
Join Date: Oct 2007
Posts: 2
Reputation:
Solved Threads: 0
I know it is probably too late to help you, but someone else may benefit from this question.
The format is quite different for the cdosys message in asp.net with VB. There is a link here that is good for explaining system.net.mail use in different languages. This is compatible with windows 2003, not 2000. W2K uses the deprecated system.web.mail format.
The format is quite different for the cdosys message in asp.net with VB. There is a link here that is good for explaining system.net.mail use in different languages. This is compatible with windows 2003, not 2000. W2K uses the deprecated system.web.mail format.
VisualBasic.NET Syntax (Toggle Plain Text)
'create the mail message Dim mail As New MailMessage() 'set the addresses mail.From = New MailAddress("me@mycompany.com") mail.To.Add("you@yourcompany.com") 'set the content mail.Subject = "This is an email" mail.Body = "this is a sample body" 'send the message Dim smtp As New SmtpClient("127.0.0.1") smtp.Send(mail)
![]() |
Similar Threads
- How do i Send and Receive Email with Attachment (Visual Basic 4 / 5 / 6)
- error : Could not access CDO.Message object (VB.NET)
- Pictures in RichTextBox (C#)
- object variable or with block variable not set (Community Introductions)
- Help with asp form will not display contact information (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: need help building radio buttons in a dynamic asp form
- Next Thread: .value
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor application asp asp.net bc30451 bottomasp.net box browser button c# checkbox click commonfunctions complex dataaccesslayer database datagridview datagridviewcheckbox datalist development dgv dropdownlist dynamically edit editing expose feedback fileuploader fill flash form formatdecimal formview google gridview gudi iframe iis javascript list listbox login microsoft migration mono mouse mssql multistepregistration news numerical object opera panelmasterpagebuttoncontrols parent problem project radio redirect registration relationaldatabases reportemail richtextbox rotatepage rows save schoolproject search security select session silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webprogramming webservice xsl youareanotmemberofthedebuggerusers





