Sending a test email from PowerShell
Powershell (smtp) Friday, 29 May 2020 by paul

When testing a SMTP email connection the tool I used to prefer was the Telnet client. It allowed you to manually type a conversation with the SMTP server and send an email if you remembered the commands and ordering. Today it is easier to test the connection using the PowerShell client built into all Windows machines. The following command will send a simple test email:

Send-MailMessage -To [email protected] -Subject "Test 1" -BodyAsHtml -Priority high -Smtpserver server-name -From [email protected] -Body "123"

The command should complete and send the email or error out.

There is detailed documentation of the Send-MailMessage command at: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7

Add Comment
No Comments.