Powershell Script to Test SMTP

Posted on

This one is going to be short and sweet, I’ve been testing SMTP with and without encryption and wanted a good script for that.

Here are the lines that you’ll want to look at configuring:

  • Line 5: “$smtpServer =”InsertYourSmtpServerHere”
  • Line 12: Change the $false value to $true if you want to encrypt your SMTP with SSL
  • Line 13: If you’re using a non-default SMTP port, change the “25” to whatever you’re using
  • Line 15: Only change this if you need to enter credentials for authentication
  • Line 18/19: Change these to who you want to say the email is from, and to whom it is being delivered.
  • Line 21: Change this to whatever you want your email title to be
  • Line 25: Change this to say whatever you want the body of the email to say

 

There are also some write-host’s in there to let you know the values that are being run and whether or not they were successful, which will print to the powershell console.

https://gallery.technet.microsoft.com/Powershell-SMTP-Test-Tool-621b07ae

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s