Troubleshooting Office 365 SMTP connections

What to do when your PHP SMTP Mail class won't connect to Office 365 SMTP mail server

Generally a common fail is "Authentication", "AUTH" or "login fails" this is normally an SMTP 334 error when trying to use a PHP class (or similar) to connect to the Office365 SMTP mail server. We've run into the problem with the Opencart mail class and other PHP mail server Classes. So a couple of things to test and make sure you have working:

Make sure Office 365 is accepting the IP address of where the SMTP mail server is sending from.

Option 1: Use TLS on port 587, you'll also need a username and password, the username must be the full email address of the account you are trying to connect as, i.e

Option 2: Use SSH on port 465, again you'll need a full username/email and password.

Option 3: Use no authentication on port 25, or post a NULL or blank username and password. This has worked with Opencart and other PHP SMTP mail classes. Using this method you must make sure that Office365 will accept your IP through the firewall. This is also good for older/legacy connection types such as wireless printers etc.

Also, try another PHP mail Class, I'd recommend PHPMailer

You can also find out about using the Office365 SMTP connections and others ways on the Office365 Connection pages


UK web browser usage stats real time What to do if your website gets deleted
Home PageDiscoverInsightsTroubleshooting Office 365 SMTP connections