How to mail by telnet

The following command cab be used to send e-mail by the SMTP. The same can be used to test what is wrong with the server.

Please read the explanations below, here the short list of the commands (between data and ”.”, the message can be written) is present for the fast use:

telnet <mail server.com> 25
helo server
mail from: <your e-mail>
rcpt to: <tested mail>
data

.
quit

Firstly we should connect to the server:

telnet <mail server.com> 25
# 220 ESMTP Mail Server Ready

The reply of server varies, but you should definitely see the '220' part. It is an indication that the server is ready to service your request.

Then we just welcome the server

helo server
# 250 Ok

write the sender and recipient mails:

mail from: <your e-mail>
#  250 Ok
rcpt to: <tested mail>
#  250 Ok

You should see the appropriate '250' notification if everything is correct, in something is wrong, the server will reply about it (for example recipient wasn't found).

and the message:

data
.
# 250 Ok: queued 

the message is started with the “data” command and end by ”.” on the clear line. The server reply is the same “250 OK” here.