Today I will show you how to test Office 365 SMTP server using PowerShell. It is very easy to check if your SMTP Server is working correctly by simply utilizing PowerShell.
Let’s dive right in.
Step 1 – Running PowerShell
Start PowerShell by pressing the Windows Key and enter PowerShell. PowerShell is available on Windows XP onwards. It should be pre-installed on Windows 7 and 10.
Step 2 – Enter your Office365 User Credentials
Next, we are going to enter our Office365 User Credentials. That’s simply the email address you want to send from and your password.
In PowerShell type:
$msolcred = get-credential
A credential window will pop up. Enter your Office 365 email address and password here.
Step 3 – Sending the test mail
Now you need to enter the following command to send a test email:
Send-MailMessage –From [email protected] –To [email protected] –Subject “Test Email” –Body “Test Text” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587
And there you have it. Now if all worked correctly, you should receive your test mail.
Make sure you have a mailbox with Exchange Online Plan set up in Office365 for this to work.