Could not access 'CDO.Message' object

  • Thread starter Thread starter Nathan Alden
  • Start date Start date
N

Nathan Alden

I've already searched Google. I've already asked people in IRC. I have still
not found a solution that works for me for this extremely discouraging
apparent bug in the SmtpMail class.

MailMessage message = new MailMessage();
// set params here
SmtpMail.SmtpServer = "mail.myispmailserver.com";
SmtpMail.Send(message);

This works if I run it in a console application on my Windows Server 2003
box. However if I execute the *exact same code* from my ASP.NET application
I receive the error message in the subject line.

I have heard various "fixes" for this, including setting permissions on
mailroot, and "explanations," including "the process ASP.NET serves pages
under is not allowed to create sockets except to localhost."

Will someone, preferrably from Microsoft, please tell me why this error
occurs (the REAL reason) and what I can do to get around it? Using an SMTP
virtual server on this box is undesirable.

Thanks.

Nathan Alden
MCSD
 
Nathan,


I had the same problem, after checking the innerExceptions I found out that
this is a problem of the mailserver not allowing you to relay e-mail. Check
your inner exceptions,
Dim sw As New System.IO.StreamWriter("<YourWebLocation>\err.log", True)

sw.WriteLine("Error " & vbCrLf & vbCrLf & ex.Message)
sw.WriteLine("InnerException 1 = " & vbCrLf & vbCrLf &
ex.InnerException.Message)
sw.WriteLine("InnerException 2 = " & vbCrLf & vbCrLf &
ex.InnerException.InnerException.Message)
sw.Close()

if there is a relay problem then DON'T set the smtpServer property, just dot
it like this :

MailMessage message = new MailMessage();
// set params here
// SmtpMail.SmtpServer = "mail.myispmailserver.com";
SmtpMail.Send(message);

that worked for me !!

Hope this helps.

Jurjen de Groot
G.I.T.S., Netherlands
 
Yes actually I had investigated the InnerExceptions and I've found it's
anything from 451 responses (LF only not allowed) to "cannot connect" etc.
 
Has anyone resolved this issue?

Our development server has migrated to another network, and now
resides as a DMZ. From the exact same box, "old" asp code can send
emails perfectly, i have spent a little over 6 hours trying to resolve
this problem trying everything mentioned in every google thread
pertinent to this problem. Before the migration, we were able to send
emails out. Now, nothing I do configuration wise seems to work.

Things I've tried:
-Changing permissions on every dll related to CDO
-Changing permissions on every directory related
-Changing relay options
-Changing smtp servers
-Impersonation for the aspnet_wp application in web.config
-changing machine.config

ASP.NET blows if it can't handle such a simple task. Why is this so
difficult? Where is microsoft to step in and enlighten us on this
"undocumented feature".

I'm at a complete loss.

Anyone with the solution, please let me/the world know.

Thanks.

-Brenton
 
Back
Top