Friday, July 31, 2009

How to send email using telnet command

It's handy to know how to send email using Telnet command, especially for debugging purpose. 

FYI, many people out there do not even realize that emails are sent via tcp/ip port 25 protocol. They told me in order to test, they need a Outlook or Thunderbird client. Those are technical people. :)

cclow@ohost:~>telnet 192.168.0.252 25
Trying 192.168.0.252...
Connected to 192.168.0.252.
Escape character is '^]'.
220 openmail.abcmail.sg -- Server ESMTP (Sun Java(tm) System Messaging Server 7.0-0.04 64bit (built Jun 20 2008))
helo abcmail.sg
250 openmail.ancmail.sg OK, [192.168.0.121].
mail from:userA@abcmail.sg
250 2.5.0 Address Ok.
rcpt to:userB@gmail.com
250 2.1.5 userB@gmail.com OK.
data
354 Enter mail, end with a single ".".
subject: test only

helo test test test
.
250 2.5.0 Ok, envelope id 0KNM007R5Y8RIX20@openmail.abcmail.sg
quit
221 2.3.0 Bye received. Goodbye.
Connection to 192.168.0.252 closed by foreign host.

.

No comments:

Post a Comment