B
bondo
I have an unusual error occurring when sending email from an ASP.NET
page. Basically, the first attempt at sending an email fails, whilst
subsequent attempts succeed without any issues. The code looks like
this:
MailMessage msg = new MailMessage();
msg.From = "(e-mail address removed)";
msg.To = "(e-mail address removed)";
msg.Body = "Testing Mail";
msg.BodyFormat = MailFormat.Text;
msg.Subject = "Testing Mail";
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["MailServer"];
SmtpMail.Send(msg);
The error messages i get by iterating through the inner exceptions of
the thrown exception are:
1st ex - Could not access 'CDO.Message' object
2nd ex - Exception has been thrown by the target of an invocation
3rd ex - The transport failed to connect to the server
I also tried using the Indy.Sockets.IndySMTP from
http://www.atozed.com/indy/ to see if this fixed the problem, but
nope, same issues.
The web server is a win2003 server. The SmtpServer variable is stored
in web.config, and is the IP address of our unix SendMail server. Its
kind of weird that the first attempt fails, then subsequent attempts
(spanning multiple sessions) succeed. Has anyone seen this before?
what did you do to fix it?
page. Basically, the first attempt at sending an email fails, whilst
subsequent attempts succeed without any issues. The code looks like
this:
MailMessage msg = new MailMessage();
msg.From = "(e-mail address removed)";
msg.To = "(e-mail address removed)";
msg.Body = "Testing Mail";
msg.BodyFormat = MailFormat.Text;
msg.Subject = "Testing Mail";
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["MailServer"];
SmtpMail.Send(msg);
The error messages i get by iterating through the inner exceptions of
the thrown exception are:
1st ex - Could not access 'CDO.Message' object
2nd ex - Exception has been thrown by the target of an invocation
3rd ex - The transport failed to connect to the server
I also tried using the Indy.Sockets.IndySMTP from
http://www.atozed.com/indy/ to see if this fixed the problem, but
nope, same issues.
The web server is a win2003 server. The SmtpServer variable is stored
in web.config, and is the IP address of our unix SendMail server. Its
kind of weird that the first attempt fails, then subsequent attempts
(spanning multiple sessions) succeed. Has anyone seen this before?
what did you do to fix it?