How to test Office 365 SMTP server using PowerShell

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.

How to test Office 365 SMTP server using Powershell
Enter your credentials

 

Step 3 – Sending the test mail

Now you need to enter the following command to send a test email:

Send-MailMessage –From mail@yourcompany.com –To user@yourcompany.com –Subject “Test Email” –Body “Test Text” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587
How to test Office 365 SMTP server using Powershell
Sending the test mail

 

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.

 

Leave a Reply

Tell us what you think!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of
%d bloggers like this: