It is quite easy to test an SMTP server using the telnet program. On most computer systems, a connection can be established using the telnet command on the client machine.
Example without authentication
The following command opens a TCP connection from the sending machine to the mail server listening on port 25 on host www.example.com.
telnet www.example.com 25 The client then waits for the server’s response which will be of the type: 220 example.com ESMTP If the server does not accepts the connection, the client quits The client then sends a Mail request showing the envelope sender address, and waits for the response: MAIL FROM:<postmaster@example.com> 250 ok If the server does not accept the request, the client quits. The client then sends one RCPT request for each envelope recipient address, waiting for a response after each address: RCPT TO:<support@example.com> 250 ok The client keeps track of which addresses are accepted. If none of the addresses are accepted, the client quits. The client then sends a DATA request, and waits for the response: DATA 354 go ahead If the server does not accept the request, the client quits. The client then sends the encoded message, waits for the response, and quits: Date: 8 Aug 1998 04:10:45 -0000 From: postmaster@example.com To: support@example.com Subject: chariot is back in service I patched up the wheel. It's as good as new. . 250 ok 902549473 qp 24035 QUIT 221 example.com If the client encounters a message I/O error, it closes the connection immediately, without sending a final dot and without sending a quite request. On sending the final dot, the handshake is complete and the mail server queues the mail for further processing.
Example with SMTP authentication
The following command opens a TCP connection from the sending machine to the mail server listening on port 25.
Open a telnet tool on your mail server. On most PC you can open a dos window and: Enter "telnet" Enter "set LOCAL_ECHO" Enter "open mail.YourDomain.com 25" (replace YourDomain.com with your domain) Enter "HELO" Enter "AUTH LOGIN" You now need to enter your emailid encoded in BASE64, press ENTER and then your password encoded in BASE64. For help converting your email and password to Base64 click http://www.motobit.com/util/base64-decoder-encoder.asp Enter your email and click "Encode" copy that value in the telnet session and press ENTER Now enter you password in the conversion tool and copy that value in the telnet session and press ENTER If you have successfully authenticated the server will return: "235 authenticated" Enter "MAIL FROM YourUserName@YourDomain.com" (replace YourUserName@YourDomain.com with your email address) Enter "RCPT TO DestinationEmail" (replace DestinationEmail with the destination email) Enter "DATA" Enter "Subject: Test using telnet" Enter "" (Send a blank line to separate the headers from the message body) Enter "This is just a test to see if I can SMTP auth from my PC" Enter "."