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;
}
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;
}