Test sending mail to your SMTP connector using Powershell

https://www.msdigest.net/2011/09/test-sending-mail-to-your-smtp-connector-using-powershell/

 

As a consultant I often test SMTP connectors on Exchange.

There are several ways of doing this. There is the good old way of using telnet, ExchangePro has a great article describing the Telnet way of testing you SMTP connection:

The other way of testing if a SMTP connector works on Exchange (2007/2010), could be using PowerShell. In PowerShell 2.0 there is a builtin cmdlet cmdlet: Send-MailMessage

You can run the following command in PowerShell to do some mail testing:

Send-MailMessage –From sender@testserverdomain.com –To recipient@recipientdomain.com –Subject “Test Email” –Body “Test E-mail (body)” -SmtpServer smtpserver.fqdndomain.local

This only works for PowerShell V2, since the command is now builtin.