Setup SMTP relay through Office 365
Migrating to Office 365 in a small office there are usually some devices or LOB (Line of Business) apps that previously used the local exchange server and now need updating. Here are some pointers to help to get it working. In my case, the annoying problem was a LOB that had a test button that confirmed everything working then sending emails didn’t work 🙁
So at the moment the details needed for SMTP relay are as follows
- From Address
- Microsoft Office 365 E-mail Address
- Reply to Address
- Microsoft Office 365 E-mail Address
- Mail Server
- smtp.office365.com
- Port
- 587
- Login
- Microsoft Office 365 Account Username
- Password
- Microsoft Office 365 Account Password
- Time out (sec)
- 60
- Message Time out (sec)
- 60
- Use TLS Encryption
- Yes
The important part was to make sure the from address matches the credentials used, to ensure the correct send as permissions. With the configuration, I worked on the timeout as this was an issue with the application which was batching emails and had a low timeout. Of course, not everything will have these settings but you can test sending from windows desktop Using PowerShell.
$msolcred = get-credential Send-MailMessage –From user@domain.com –To user@hotmail.com –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587
Another important point is the TLS configuration I had to use in the LOB I setup, compared to the PowerShell testing. If you have issues with sending and have multiple selections for TLS/Ssl try different options.
Hope this helps others.