Using Windows (2008) is there an easy command line tool that I can use to send a test email from a server to test the SMTP, user authentication, ports, etc... without writing my own?
Your best, easiest and most globally available tool: telnet
- At command prompt, type: telnet mail.mailserver.com 25
- Type EHLO , and then press ENTER.
Type AUTH LOGIN. The server responds with an encrypted prompt for your user name.
Enter your user name encrypted in base 64. You can use one of several tools that are available to encode your user name.
The server responds with an encrypted base 64 prompt for your password. Enter your password encrypted in base 64.
Type MAIL FROM:, and then press ENTER. If the sender is not permitted to send mail, the SMTP server returns an error.
Type RCPT TO:,and then press ENTER.If the recipient is not a valid recipient or the server does not accept mail for this domain, the SMTP server returns an error.
If desired, type message text, press ENTER, type a period (.), and then press ENTER again.
If mail is working properly, you should see a response similar to the following indicating that mail is queued for delivery:
250 2.6.0 MAILID-SOMETHINGHERE@mail.somedomain.com.
For me, the easiest method is using Send-MailMessage in Powershell. From the Powershell console simply run:
PS C:\Users\admin> 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"
Loads more options can be found on this link:
If this is something that you have to test once in a while, or just for a small number of SMTP servers, then telnet may be the most convenient tool, as it has been pointed out. The best thing about telnet is that it's an almost universal tool, and that it allows you not only to test an SMTP server but also other services like POP, IMAP, etc.
However, if you're performing this tests regularly or on a bigger scale, i'd highly recommend using swaks. It's extremely easy to use and can also perform other tasks like sending attached files (which can be useful for testing your mail content filters).
It will also give you useful exit codes, so that you can even use it to perform automated tests.
I use it frequently on Linux, but being a Perl script, you should be able to run it on a Windows box without any problems.
If you don't want to manually run through the entire SMTP transaction you can use a command line tool such as blat to send emails.
You can try an online service that will do the work for you. You can quickly find out about common SMTP server issues