G
Guest
I am using the following code on a company that hosts our web site. I have
noticed lately that their mail server/smtp is unavailable several times a
minute for a second or two. This is causing my script to fail when it calls
the client.Send(msg); - script is below the error message below... Any
ideas????
ERROR MESSAGE
------------------------------------------
Service not available, closing transmission channel. The server response
was: Command timeout, closing transmission channel
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Service not available,
closing transmission channel. The server response was: Command timeout,
closing transmission channel
Source Error:
Line 51: client.Send(msg);
---------------------------------------------
Code in Page
---------------------------------------------
// create email
MailMessage msg = new MailMessage();
msg.From = new MailAddress("(e-mail address removed));
msg.To.Add(new MailAddress("(e-mail address removed)"));
msg.Subject = "Test Message";
string bod = "<html><head><body><b>Message:</b><br>blah test</body></html>";
msg.Body = bod;
msg.IsBodyHtml = true;
// send email
SmtpClient client = new SmtpClient();
client.Host =
System.Configuration.ConfigurationManager.AppSettings["smtpaddress"];
client.Timeout = 1000000;
client.Send(msg);
---------------------------------------------
noticed lately that their mail server/smtp is unavailable several times a
minute for a second or two. This is causing my script to fail when it calls
the client.Send(msg); - script is below the error message below... Any
ideas????
ERROR MESSAGE
------------------------------------------
Service not available, closing transmission channel. The server response
was: Command timeout, closing transmission channel
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Service not available,
closing transmission channel. The server response was: Command timeout,
closing transmission channel
Source Error:
Line 51: client.Send(msg);
---------------------------------------------
Code in Page
---------------------------------------------
// create email
MailMessage msg = new MailMessage();
msg.From = new MailAddress("(e-mail address removed));
msg.To.Add(new MailAddress("(e-mail address removed)"));
msg.Subject = "Test Message";
string bod = "<html><head><body><b>Message:</b><br>blah test</body></html>";
msg.Body = bod;
msg.IsBodyHtml = true;
// send email
SmtpClient client = new SmtpClient();
client.Host =
System.Configuration.ConfigurationManager.AppSettings["smtpaddress"];
client.Timeout = 1000000;
client.Send(msg);
---------------------------------------------