Sending email using telnet

Every admin knows as to use telnet to test remote port connectivity. But did you know that you can use this command in more ‘creative’ manners ?

For example to send mail in a fully manual mode:

# telnet localhost smtp
Connected to localhost.
Escape character is '^]'.
220 sd-35049.dedibox.fr ESMTP Exim 4.72 Mon, 16 Jan 2012 12:56:06 +0100
HELO sd-35049.dedibox.fr
250 sd-35049.dedibox.fr Hello localhost [::1]
mail from: megamind@secretbase.com
250 OK
rcpt to: foobar@yopmail.com
250 Accepted
data
354 Enter message, ending with "." on a line by itself
Hey genius buddy
This is a test!
.
250 OK id=1cT5uM-0001oK-Dm
quit
221 sd-35049.dedibox.fr closing connection
Connection closed by foreign host.