Tuesday, December 23, 2008


Using Telnet to Send Email Through an SMTP Gateway

The first thing to do is to open a connection from your computer to your mail server using telnet.

telnet mail.domain.ext 25

You should receive a reply like:
220 SMTP Proxy Server Ready

You will then need to declare where you are sending the email from:

HELO local.domain.name
Don't worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world. The mail server has no choice but to take your word for it as of RFC822-RFC1123.

This should give you:
250 +OK SMTP server Ready

Now give your email address:
MAIL FROM: mail@domain.ext

Should yield:
250 +OK Sender OK

Now give the recipients address:
RCPT TO: mail@domain.ext

Should yield:
250 +OK Recipient OK

To start composing the message, issue the command:

If you want a subject for your email, type:
Subject: -type subject here-
then press enter twice (these are needed to conform to RFC 882)

You may now proceed to type the body of your message.

To tell the mail server that you have completed the message enter a single "." on a line of its own.

The mail server should reply with:
250 +OK message queued for delivery.

You can close the connection by issuing the QUIT command.

The mailserver should reply with something like:
221 Service closing transmission channel closing connection
Connection to host lost.


The commands are not case sensitive, but if you make a typing mistake, backspace & correct, you will get this error:
500 Command unrecognized: commandname

If you make a typing mistake on the recipient's name, backspace & correct, the message will not be deliverable.

modified from http://www.yuki-onna.co.uk/email/smtp.html