Powershell SMTP Script
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.