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);
Will adding "client.Timeout = 1000000;" help my problem if the server can't
be reached or does the timeout assume the server can be reached but waits for
it to become less busy?
// 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.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);
Will adding "client.Timeout = 1000000;" help my problem if the server can't
be reached or does the timeout assume the server can be reached but waits for
it to become less busy?
// 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.Send(msg);