Monthly Archives: December 2012

Send an attachment via email

It is possible to use telnet to send an email. This is even quite straightforward.
The idea is to start a telnet session with: telnet 25 (or something alike that contains an email server to which one has connection.

One could then enter to indicate the sender and receiver of an email:

mail from:
rcpt to:

The actual content of the email is then provided by:

Subject: Onzin van Tom
MIME-Version: 1.0 
Content-Type: multipart/mixed; 
 boundary= "KkK170891tpbkKk__FV_KKKkkkjjwq" 

Content-Type: text/plain; charset=US-ASCII 

Dit is mijn boodschap

One finishes with an empty line and a dot:


All commands and the actual text is sent in plain text. It is human readable.
This makes it understandable that an attachment which is in binary format must be translated into plain text before it can be sent. Let us take as example an Access file (a.mdb), that must be translated into plain text. This will look like:

MIME-Version: 1.0
Content-Description: "Base64 encode of a.mdb by Wincode 2.7.3"
Content-Type: application/msaccess; name="a.mdb"
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename="a.mdb"




A full example can be found here: ExampleEmail.

One may question how the encoding can be accomplished. To do so, I found a set of useful websites (like ) in which you may upload the binary file and one may get it encoded back. This can then be included in the mail session.