SmtpMail Could not access 'CDO.Message' object ONLY with HTML form

G

Guest

Hello,

I've read a lot of threads on this subject, but they typically go back to a problem with the smtp server configuration. In my case, everything works great until I uncomment the one line below. Once I set the BodyFormat to MailFormat.Html then I get:

HttpException (0x80004005): Could not access 'CDO.Message' object

Otherwise, everything works fine and I get my html tags in plain text. I've got it working (in plain text) with my local smtp server (as below) and two ISP's... all throw the same error as soon as I set the format to HTML. The email addresses have, of course, been edited for the post.

Any ideas?
Thanks,
Michael

<CODE>

MailMessage m = new MailMessage();
m.To = "(e-mail address removed)";
m.From = “[email protected]â€;
m.Subject = "testing";
//m.BodyFormat = MailFormat.Html;
m.Body = "this is my test email body.<br><b>this part is in bold</b>";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(m);

</CODE>
 
A

Andy Miller

I just ran into the same issue (same message...same conditions).
Switching to text format allows mail to be sent. I suspect it is a
permission issue. I think the mailer is trying to build at least one
attachment to handle the HTML. I'm still investigating.

Michael said:
By the way, here's the full error:

[COMException (0x80040605): Unknown Error]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
System.Web.Mail.LateBoundAccessHelper.SetProp(Type type, Object obj, String propName, Object propValue)
System.Web.Mail.LateBoundAccessHelper.SetProp(Object obj, String propName, Object propValue)

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.SetProp(Object obj, String propName, Object propValue)
System.Web.Mail.CdoSysHelper.Send(MailMessage message)
System.Web.Mail.SmtpMail.Send(MailMessage message)
tms1.mailtest.btnGo_Click(Object sender, EventArgs e) in mailtest.aspx.cs:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

_______________________________________________________________

Michael said:
Hello,

I've read a lot of threads on this subject, but they typically go back to a problem with the smtp server configuration. In my case, everything works great until I uncomment the one line below. Once I set the BodyFormat to MailFormat.Html then I get:

HttpException (0x80004005): Could not access 'CDO.Message' object

Otherwise, everything works fine and I get my html tags in plain text. I've got it working (in plain text) with my local smtp server (as below) and two ISP's... all throw the same error as soon as I set the format to HTML. The email addresses have, of course, been edited for the post.

Any ideas?
Thanks,
Michael

<CODE>

MailMessage m = new MailMessage();
m.To = "(e-mail address removed)";
m.From = “[email protected]â€;
m.Subject = "testing";
//m.BodyFormat = MailFormat.Html;
m.Body = "this is my test email body.<br><b>this part is in bold</b>";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(m);

</CODE>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top