Friday, March 15, 2019

How to test Office 365 SMTP server using Powershell

Everyone is familiar with sending a test email through an SMTP server using telnet. However Office 365 requires authenticating the user account and does not play fair the traditional way. Use the following information for sending a test email through Office 365 using Powershell.

3 Steps total

Step 1: Run Powershell

Powershell is available with Windows XP onwards.

Step 2: Enter your Office 365 User Details

$msolcred = get-credential

Step 3: The command to send a test email

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
Dont forget to replace the required information with your info.
eg: From, To, Subject, Body
Also please note the From address must be the same email address associated with the provided user credentials.

No comments:

Post a Comment