Test SMTP Relay in Office365

Hello Team,  

I am back with my 3rd blog and this blog is primarily with testing SMTP relay with Office365 for that matter this testing can be used against any email applications which does SMTP relay.

I would primarily concentrate with Office365 SMTP relay. There have been scenario with me while troubleshooting SMTP relay I really wanted some reliable tool to troubleshoot issue from customer machine or network.  

  • Telnet works awesome if your SMTP server is Office365 MX record.
  • If you use Office365 SMTP server i.e. smtp.office365.com on telnet it does not work because authentication is mandatory and for some reason I was not able to make authentication work in Telnet

After lots of research and brainstorming I was able to get awesome reliable tool i.e. PowerShell (which is installed on most of the windows machine). I am going to share the step which I used to test customer's scenario.

How to test SMTP server using PowerShell.

This command is to drop email using SMTP server

$msolcred = get-credential | save the credential of from address

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

This command is to drop email using MX records

Send-MailMessage –From user@domain.com –To user@hotmail.com –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer domain.mail.protection.outlook.com  

I hope above steps will help many admin's to affectively troubleshoot and test SMTP relay server against Office365 or any SMTP email servers.

Regards,

Santp.