Testing Mail Relay / Sending Email Using PowerShell

Sometimes we need to test sending an email using mail relay and normally we telnet to mail relay on port 25 which is a bit complicated and extensive method in my view. Using that method if you make any typo, you would have to start from scratch.

A simple PowerShell command can be used instead to test the mail relay or smtp server given that you do have access to relay through that.

This is also very useful to test out all exchange transport servers in case you are having issues where a transport rule is working intermittently. It could be due to one or few exchange hub transport servers which you can easily find out by using this method. In those cases, restart of transport service will fix that server.

Send-MailMessage -From test@xyz.com -To test@abc.com -SmtpServer mailrelay.test.com -Body “Testing mail relay” -Subject “Test email”

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: