Saturday, September 10, 2005

Sending email using Telnet

Most probably, you will only do this for testing or troubleshooting.

The example below shows you the basic steps of using Telnet to send email via SMTP and you can check out RFC 821 for more information. If you wish to try it out, make sure there is no firewall or anti-virus blocking telnet from using port 25.

Step 1
At the command prompt, type in telnet Your_Smtp_Server 25 replacing Your_Smtp_Server with your own SMTP server name. This is to establish a telnet session with the SMTP server via port 25.
telnet smtp18.smtp.com.sg 25

Step 2
Once you have the session established, you need to identify yourself by using the HELO command. For example, HELO My_Domain_Name.
220 smtp18.smtp.com.sg ESMTP ; Sat, 10 Sep 2005 00:45:23 +0800
helo test.com.sg
250 smtp18.smtp.com.sg Hello bb219-74-178-179.test.com.sg [xxx.xx.xxx.xxx], pleased to meet you

Step 3
You will now need to provide the reverse path. This will appear as the sender for the recipient who receives the email. For example, MAIL FROM:My_SMTP_Email_Address.
mail from:nrz@test.com.sg
250 2.1.0
nrz@test.com.sg... Sender ok

Step 4
Now you need to provide the recipient's smtp email address. For example, RCPT TO:Recipient_SMTP_Email_Address.
rcpt to:myfriend@yahoo.com
250 2.1.5
myfriend@yahoo.com... Recipient ok

Step 5
Next you will provide the message that you want to send out by using the DATA command.
data
354 Enter mail, end with "." on a line by itself
subject:Sending Mail using Telnet I am trying to send mail using Telnet.
.
250 2.0.0 j89GjNT8013407 Message accepted for delivery

Step 6

Finally to quit from the session, use the QUIT command.
quit 221 2.0.0 smtp18.smtp.com.sg closing connection


Have fun and enjoy.

No comments: