Hi,
We have utility function to send email using SmtpClient object. This works fine to send all email ids( e.g. hotmail.com, yahoo.com, gmail.com etc) but not working for outlook.com email ids. It throws the following timed out error whenever we use to to email outlook.com. What could be the issue?
This is what the error we receive:
System.Net.Mail.SmtpException was caught
HResult=-2146233088
Message=The operation has timed out.
static void SendMailUsingSMTP(string mailFrom, string mailTo, string mailSubject, string mailBody) { try { //SMTP server address string smtpUrl = "SMTP_SERVER_NAME"; MailMessage mailMessage = new MailMessage(); mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; mailMessage.From = newMailAddress(mailFrom); mailMessage.To.Add(newMailAddress(mailTo.ToString())); mailMessage.Body = mailSubject; mailMessage.Subject = mailSubject; mailMessage.IsBodyHtml = true; mailMessage.Priority = MailPriority.Normal; SmtpClient mSmtpClient = new SmtpClient(smtpUrl); mSmtpClient.Send(mailMessage); } catch (SmtpException ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); }