Sending Email With Telnet

Here’s a very interesting piece of information. You can send an email message by typing commands directly to the mail server. The protocol used to send email all over the world is simple enough that a human can type it out on their keyboard. Using a program called Telnet, you can send an email the same way that your mail client such as Outlook or Thunderbird would do. The conversation looks something like this (I’m using -> to denote what the user types, and

-> HELO mail.example.com
<- 250 Welcome to the mail server
-> MAIL FROM:sender@example.com
<- 250 Continue 
-> RCPT TO:recipient@example.com
<- 250 Continue
-> DATA
<- Please enter message. enter a single period followed by a "." to complete sending
-> SUBJECT: This is my message subject
-> 
-> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-> Curabitur elit justo, pretium ut lacinia non, dapibus eu magna. 
-> Duis nunc quam, lacinia sit amet hendrerit ac, malesuada in magna.
-> Duis dapibus elit a nisi ultrices dictum semper sem scelerisque. 
-> Nulla arcu lacus, placerat eu vehicula et, malesuada nec magna. 
-> .
<- 250 Message accepted for delivery

 

That’s basically it. Every email message that gets sent anywhere can be sent like that. In fact, the only thing you can send over email is text. All those pictures, or other attachments that are sent over email actually have to be encoded to type-able text using MIME. And because of this, the attachment will take 1/3 more space than the original file when sent over email. That is, a 300 KB email attachment with actually require 400 KB to be sent over the internet.

I just find it amazing how long email this simple protocol has stood the test of time. Sure things have been tacked on, to allow for authentication with the server, as well as a few other things, but not much. Makes me think of one of my favourite software development rules. Do the simplest thing that could possibly work.

Leave a Reply

Your email address will not be published. Required fields are marked *