SMTP server can be tested simply by using telnet client. On Windows 7 above telnet client has to be installed first via control panel (Windows Add/Remove Features)
Following is a sample SMTP commands to send for a standard mail server listening on IP 220.127.116.11 port 25, without authentication
C:\telnet 18.104.22.168 25 HELO mycompany.com MAIL FROM:email@example.com RCPT TO:firstname.lastname@example.org DATA To: Gerry Tan <email@example.com> From: My Company Support <firstname.lastname@example.org> Subject: Testing mail server via SMTP Please ignore this email as this is just testing mail server via SMTP . quit
The two newlines and dot at the end is important.
SMTP Server With Authentication
To use SMTP username / password authentication, you first need to encrypt it to Base64. It can be done with command line perl:
perl -MMIME::Base64 -e 'print encode_base64("gerrytan");' perl -MMIME::Base64 -e 'print encode_base64("Mypass123");'
Becareful if you username / password contains symbols meaningful to perl! An @ character can be interpreted as perl array. You have to escape it using \ (I spent an hour figuring out why authentication failed due to this).
And issue AUTH LOGIN command after HELO / EHLO. The server will prompt for username and password in Base 64
220 mail.tpg.com.au ESMTP (mail16) Sendmail ready. EHLO mail.tpg.com.au 250-mail16.tpgi.com.au Hello webmail.mxtglobal.com [22.214.171.124], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 28521268 250-DSN 250-AUTH LOGIN PLAIN 250-STARTTLS 250-DELIVERBY 250 HELP AUTH LOGIN 334 VXNlcm5hbWU6 ********** 334 UGFzc3dvcmQ6 ********** 235 2.0.0 OK Authenticated MAIL FROM:email@example.com 250 2.1.0 firstname.lastname@example.org... Sender ok RCPT TO:email@example.com RC250 2.1.5 firstname.lastname@example.org... Recipient ok
Thanks to http://exchange.mvps.org/smtp_frames.htm.