Test SMTP from server
Ever need a quick and easy way to test SMTP relay from a Windows server? Does this feel familiar? You come into work and before you can grab your much needed cup of caffeine, you notice a line forming outside your office. Apparently none of the scheduled reports from the night before were emailed to the executive branch and of course it must be the server’s fault. Being the network admin that you are, you realize it can be many things for example something happening with the Exchange CAS servers, or something else wrong with the Exchange environment or dare I even suggest, a potential issue with the software application itself. Before you go chasing that rabbit down the rabbit hole, I suggest performing a simple SMTP relay test on the server using the Send-MailMessage PowerShell command.
On the server in question, Open Powershell as Admin
Run the following command:
Send-MailMessage -SMTPServer smtp.domain.com -To email@example.com -From firstname.lastname@example.org -Subject “This is a test email” -Body “Hi, this is a test email sent via PowerShell to test the STMP relay server”
If successful, you will receive the email and explain to those who are camped out your door, that it is NOT the server that is preventing their reports from being emailed. Now go grab that cup of coffee before it gets stale! You deserve it!
By the way, if you’ve been looking for a PowerShell book for learning or even reference, take a look at Learn Windows PowerShell in a Month of Lunches. I own this book. The authors Don Jones and Jeffrey Hicks are extremely good at explaining this powerful platform which is in my opinion, is essential for any network admin to know and understand.