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:
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: firstname.lastname@example.org
250 +OK Sender OK
Now give the recipients address:
RCPT TO: email@example.com
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