Unable to send email with smtp.office365.com
Hi everyone,
I've recently signed up for Office 365 and attempted to setup my web application to send email using office365 smtp server. Below is chunk of code setup for sending out email. It works fine on the old server but when I pointed to office365, I got the error message below that states 5.7.3 STARTTLS is required. I've been trying to research the last few days but no luck so just wondering if anyone has any thought or suggestion on how to resolve this issue?
System.Net.Mail.SmtpClient objSMTP = new System.Net.Mail.SmtpClient
{
Host = "smtp.office365.com",
Port = 587,
Credentials = new NetworkCredential(username, password)
};
objSMTP.Send(emailObject);
Error in processing. The server response was: 5.7.3 STARTTLS is required to send mail [MW4PR04CA0144.namprd04.prod.outlook.com 2025-01-18T18:17:52.571Z 08DD36985A2F8B35]Failed to send email message.
Thanks,