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 comment