Getting pretty desperate- Please help - Using "MailMessage" and "SmtpMail" on a WinXP Prof box wi

D

dorisferrarese

I am running into the wonderful expection:
"Could not access 'CDO.Message' object."
"Exception has been thrown by the target of an invocation."

You can checkout my code below -
The interesting part with my error is that it only occurs with:
myMessage.BodyFormat = System.Web.Mail.MailFormat.Html;

The email relays perfectly fine with:
myMessage.BodyFormat = System.Web.Mail.MailFormat.Text;

I have spent 1.5 days on this so far ..
~ Doris.

----------------------------------------------------------------------------------------
This is my code:

try
{
MailMessage myMessage = new MailMessage();
myMessage.From = "(e-mail address removed)";
myMessage.To = "(e-mail address removed)";
SmtpMail.SmtpServer = "";

myMessage.BodyFormat = System.Web.Mail.MailFormat.Html;
myMessage.Body = "<html><head></head><body>Hello Andrei</
body></html>";
//myMessage.BodyFormat = System.Web.Mail.MailFormat.Text;
//myMessage.Body = "test";

SmtpMail.Send(myMessage);

}
catch(Exception ex)
{
throw new Exception(strMessage);
}
 

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

Top