Unable to send email with smtp.office365.com

Tri Nguyen 0 Reputation points
2025-01-18T19:00:48.5533333+00:00

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,

Microsoft Office Online Server
Microsoft Office Online Server
Microsoft on-premises server product that runs Office Online. Previously known as Office Web Apps Server.
668 questions
Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,840 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,158 questions
Microsoft 365 Publishing
Microsoft 365 Publishing
Microsoft 365: Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line. Publishing: The process of preparing, producing, and releasing content for distribution or sale.
630 questions
Microsoft Configuration Manager
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.