Hi all, I am using an asp.net page to send e-mail to an internal exchange
server. The code completes, but the mail doesn't get sent from webserver for
at least a minute or more. Is there any reason why the e-mail is delayed?
My code to mail is below:
public void SendEmailToTech nician(string sTo, string sSubject, string
sBody)
{
oMailMessage.Fr om = new
MailAddress(Con figurationManag er.AppSettings["SMTPFromAddres s"].ToString());
oMailMessage.To .Add(new MailAddress(sTo ));
oMailMessage.Su bject = sSubject;
oMailMessage.Bo dy = sBody + "<END MESSAGE>";
oMailMessage.Is BodyHtml = false;
oMailMessage.Pr iority = MailPriority.Hi gh;
SmtpClient oClient = new
SmtpClient(Conf igurationManage r.AppSettings["SMTPServer "].ToString());
oClient.Deliver yMethod = SmtpDeliveryMet hod.Network;
try
{
oClient.Send(oM ailMessage);
}
catch (Exception ex)
{
oGlobal.Redirec t("Error.aspx?E rror=" + ex.Message.ToSt ring() +
"&STACK=" + ex.StackTrace.T oString());
}
}
server. The code completes, but the mail doesn't get sent from webserver for
at least a minute or more. Is there any reason why the e-mail is delayed?
My code to mail is below:
public void SendEmailToTech nician(string sTo, string sSubject, string
sBody)
{
oMailMessage.Fr om = new
MailAddress(Con figurationManag er.AppSettings["SMTPFromAddres s"].ToString());
oMailMessage.To .Add(new MailAddress(sTo ));
oMailMessage.Su bject = sSubject;
oMailMessage.Bo dy = sBody + "<END MESSAGE>";
oMailMessage.Is BodyHtml = false;
oMailMessage.Pr iority = MailPriority.Hi gh;
SmtpClient oClient = new
SmtpClient(Conf igurationManage r.AppSettings["SMTPServer "].ToString());
oClient.Deliver yMethod = SmtpDeliveryMet hod.Network;
try
{
oClient.Send(oM ailMessage);
}
catch (Exception ex)
{
oGlobal.Redirec t("Error.aspx?E rror=" + ex.Message.ToSt ring() +
"&STACK=" + ex.StackTrace.T oString());
}
}
Comment