Share via


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.

Comments

  • Anonymous
    January 01, 2003
    Thanks Ryan.
  • Anonymous
    January 01, 2003
    thanks for sharing.
  • Anonymous
    January 01, 2003
    Thank you Samuel.
  • Anonymous
    January 01, 2003
    Thank you Sinan, Recep YUKSEL n Ed (DareDevil57)
  • Anonymous
    January 01, 2003
    Sean, It does work. This parameter is available from Windows Powershell Verion 4.0. Please find Technet Link for it.
    http://technet.microsoft.com/en-us/library/hh849925.aspx
  • Anonymous
    April 15, 2014
    Awesome, thanks for this post. I used this today to test relaying with another user's credentials.
  • Anonymous
    May 02, 2014
    Thank you for this useful post. I used the process and found it really helpful.If you want to check more update about smtp server, do visit http://bestsmtpserver.com/
  • Anonymous
    September 19, 2014
    this does not work- it rejects the parameter 'port'
  • Anonymous
    September 19, 2014
    The comment has been removed
  • Anonymous
    October 08, 2014
    The comment has been removed
  • Anonymous
    October 14, 2014
    I upgraded to power shell 4.0 and the command started working. check your level. $psversiontable
  • Anonymous
    February 13, 2015
    where do I check the SMTP relay if it's running?Please assist I'm new in working with VM's. Thank you