Menu

How to send Email via Telnet

19.05.2014 - Linux

Why we need to Send Email via Telnet ?

On occasion, we write code that sends email. Sometimes, it actually works the first time.
More often, we need to figure out why not.

While it’s nicest to have the computer emulate what the human would get bored doing.
Sometimes it helps to have the human do what the computer can’t quite seem to do on its own.
For that reason, we sometimes resort to manual telnet sessions with a remote mail server.

Simple manual telnet session with mail host
Uppercase/lowercase does not appear to be significant.

You do/type this Server responds with
Telnet to hostname on port 25 220 (then identifies itself – possibly with several lines of 220 + text)
HELO your_domain_name or whatever 250 (followed by human readable message)
MAIL FROM:you@hostname.com (ie, your email address) 250 <you@hostname.com> is syntactically correct (or similar)
RCPT TO:them@someplace_else.com (email address you want to send to) 250 <them@someplace_else.com> is syntactically correct
DATA Tells you to send data then CRLF period CRLF at end
You type your message then CRLF period CRLF (ie, type a period on a line by itself then hit ENTER) 250
QUIT Signoff message

Our tutorial in action:
Send Email via Telnet