Send Email From Windows PowerShell

Sometimes need to test SMTP configuration from Windows machines with no extra stuff installed. 

Tested on Windows PowerShell 2.0:

PS> $PSVersionTable.PSVersion

Major Minor Build Revision
----- ----- ----- --------
2     0     -1    -1

Send an e-mail message:

PS> Send-MailMessage -SmtpServer mail.example.com -Credential sandy -To [email protected] -From [email protected] -Subject "Test" -Body "Hello"

Windows PowerShell credential request pop-up will appear where you have to type sandy’s password.

Leave a Reply

Your email address will not be published. Required fields are marked *