The first thing you want to do when you setup SMTP server is to test it. (yep, I consider myself smart).
When the SMTP server setup was ‘once in a blue moon’ process, I could afford to just set up the client through the local Outlook or any other mail client, through Gmail and such.
The task became a chore if you had to setup SMTP on all new applications, and had to be repeated twice every month. The fact that not all SMTP servers are the same and cannot be tamed by me in one go - just adds to the fun.
Instead of writing my own program for the initial testing, I just use the below Powershell script in Windows 10.
$EmailFrom = "firstname.lastname@example.org" $EmailTo = "email@example.com" $Subject = "hello" $Body = "Just saying hello to the world." $SMTPServer = "newdomain.com" $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25) $SMTPClient.EnableSsl = $false $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("firstname.lastname@example.org", "!uncrackablepass!"); $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Create a script file and run that for max effect. Or, simply copy /paste the code in the Powershell prompt to test your SMTP server.
Hope you did read that this was applicable to Powershell? It does not work in CMD or the ‘normal’ command prompt in Windows.