Could not access 'CDO.Message' object.

T

Thomas I.

I "occastionally" receive this error message when sending e-mail through the
code below. It doesn't happen every time, but perhaps 10-30% of the time, I
receive this exception message.

SendCorrespondence: exception: Could not access 'CDO.Message' object.

Any suggestions greatly appreciated!

Thanks

Here's the source code:

private static bool SendCorrespondence(System.Web.UI.Page Page)
{
bool bReturn = true;

try
{
MailMessage mail = new MailMessage();
mail.BodyFormat = MailFormat.Text;
mail.To = <to>;
mail.Bcc = <bcc>;
mail.From = <from>;
mail.Subject = <subject>;
mail.Body = <body>;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"webapp@<site>.com"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"<pw>"); //set your password here
SmtpMail.SmtpServer = "<mail server>"; //your real server goes
here
SmtpMail.Send(mail);
}
catch (Exception objException)
{
bReturn = false;
WriteLog ("SendCorrespondence: exception: " +
objException.Message);
}
finally
{
}

return bReturn;
}
 
T

Thomas I.

I added a check of the InnerException, with this code:

if (objException.InnerException != null)
{
WriteLog ("SendCorrespondence: InnerException: exception: " +
objException.InnerException.ToString());
}

Here's what I got, but I sure don't know what it means.

SendCorrespondence: InnerException: exception:
System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. --->
System.Runtime.InteropServices.COMException (0x80040211): The message could
not be sent to the SMTP server. The transport error code was 0x80040217. The
server response was not available
 
S

Steven Berkovitz

This exception gets thrown anytime there is a problem communicating with the
SMTP server.
 

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,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top