Technically speaking, MIME POST, is a service to send your emails. But why the name MIME POST and what does it mean? Well, it means exactly what we do.
We at MIME POST defines MIME Post as "posting your messages in MIME format".
When we first thought about this name, it instantly made sense to us. It was very rational and meaningful name for our service.
With only downside that non-tech ordinary people may not understand it. But this was not an issue as our service is for developers and not for normal humans :)
By the way, many of the our developers might have forgotten about what is MIME :(. It is like a long forgotten hero. So let me take this opportunity to explain you in a bit details about what is MIME and what problem did it solve?
When email introduced to the world. It was very simple, using just SMTP protocol. The SMTP protocol is all text. Due to this simplicity it had widely spread and was adopted by all the systems to send the email messages. But there was also a problem due to this all text thing. It was not possible to send non-text files like images, videos, etc with email. To fix this problem MIME was introduced.
MIME stands for Multipurpose Internet Mail Extension, as it is an extension (not replacement) of the original email protocol and with the help of this extension protocol it was possible to send any arbitrary binary files with email. In a layman words, MIME extends email to add non-text files like images, video, audio, etc by converting them to text and then adding to the email with a predefined format.
MIME is an open standard defined in multiple RFCs (RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC 4288 and RFC 4289 )
Below is the diagram, which shows how MIME fits into the actual email sending process from start to the end:
⚠ Warning!: The below content is for developers only, so if you are not a developer then reading this material may lead to headache and hyper-boredom :|
Let's continue with our example from the above picture. The Bob wants to send an email to Alice with a HTML content along with a text copy of the same HTML content and an image in gif format as an attachment.
The Bob's client software (User Agent), let say Thunderbird, will convert his HTML message with attached gif image file into MIME format.
About MIME headers:
MIME divides the email message into different parts, according to the type of media and number of different files used. And uses MIME headers for each parts, to give details about what is the type of file and how it got encoded. Thus, enabling receiving system to decode it accordingly.
The headers are nothing but key value pairs separated by a colon (:).
Example:
MIME-Version: 1.0
The headers were already in use before the arrival of MIME (https://tools.ietf.org/html/rfc821). They were mainly Date:, From:, To:, Subject:. However, the MIME has introduced its own headers.
Below are the some example of most used MIME headers:
… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable …
MIME Boundaries:
Under MIME format (protocol) every part is divided by sequence of characters, strings, which are called as boundaries. The creating system must declare the boundary in the header. And then use it everywhere to divide the different parts of the message. See the below example of using boundaries:
Notes:
Example of Boundaries:
… // text omitted for readability MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_c140ce4cf192355b7f18f7e9fc936943" --b1_c140ce4cf192355b7f18f7e9fc936943 … // Part 1 - actual text omitted for readability --b1_c140ce4cf192355b7f18f7e9fc936943 … // Part 2 - actual text omitted for readability --b1_c140ce4cf192355b7f18f7e9fc936943 … // Part 3 - actual text omitted for readability --b1_c140ce4cf192355b7f18f7e9fc936943-- //End of message
Conversion from binary to text format:
Now the last step for crafting multi media content into the MIME format for the message creating software (email client) is to convert every binary or non-ascii files into text format using any standard binary to text format like base64. The headers like Content-Type, Content-Transfer-Encoding must mention the accurate media type and encoding. Thus, enabling the receiving system to decode the same without any errors.
So our gif in example will change into text in MIME like below:
… //text omitted for readability --b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4 Content-Type: image/gif; name="mime-post-bg-white.gif" Content-Transfer-Encoding: base64 Content-ID:Content-Disposition: attachment; filename=mime-post-bg-white.gif R0lGODlhPAE3APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4O Dg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEh … //text omitted for readability E+HO+0xCRbPPJv1RJlVELEWogmzSKE1CeuiFASQI9BsDxyJTKd2hMz2SElhTvXTTOrVTDFVEJ73T PeVTO/XNWaCCwahBnHqBLbgYH91TfCAHQMVAr/jHQj3UPpXUSaXUSrXUO4VBVLCDKNiBR3yCnIsG C73Uk4nBTe3UHfhUORHVUWXVVnXVV63Ts/yrSDALILEzWK1EcMC2iWSdoQBTXAXWYBXWYV1CyOTP 7mpTPlUlY+3PYXXWZ4VWWLXPZKVULdXTaMXWbNVWyAoIADs= --b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4--
The final output is below:
Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost for; Wed, 7 Nov 2018 12:32:27 +0000 (UTC) Date: Wed, 7 Nov 2018 18:02:21 +0530 To: alice@example.com From: BOB Subject: Here is the subject Message-ID: <3061865371088977059531685531590863093761872653295@example.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4" Content-Transfer-Encoding: 7bit --b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4 Content-Type: multipart/alternative; boundary="b2_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4" --b2_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4 Content-Type: text/plain; charset=us-ascii This is the body in plain text for non-HTML mail clients --b2_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4 Content-Type: text/html; charset=us-ascii This is the HTML message body in bold!
--b2_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4-- --b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4 Content-Type: image/gif; name="mime-post-bg-white.gif" Content-Transfer-Encoding: base64 Content-ID:Content-Disposition: attachment; filename=mime-post-bg-white.gif R0lGODlhPAE3APcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4O Dg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEh … //TEXT OMITTED FOR READABILITY PeVTO/XNWaCCwahBnHqBLbgYH91TfCAHQMVAr/jHQj3UPpXUSaXUSrXUO4VBVLCDKNiBR3yCnIsG C73Uk4nBTe3UHfhUORHVUWXVVnXVV63Ts/yrSDALILEzWK1EcMC2iWSdoQBTXAXWYBXWYV1CyOTP 7mpTPlUlY+3PYXXWZ4VWWLXPZKVULdXTaMXWbNVWyAoIADs= --b1_gZ6UOzUHeJbi9sedJDkaVYhCNHJ74jYf8EIOZ7tRp4--
You can download the complete eml here
Ready to send
Now, the final step, for the creation system, I mean the Bob's email client, is to send this long big text via SMTP protocol to the configured email server (Host running an MTA - Mail Transfer Agent program). That email server will transfer it again to the receiver's .ie. Alice's email server. Then at last Alice email client (outlook or thunderbird) will download this via IMAP or POP protocol and converts its back again from black and white text to colourful multi media files, in this case our gif image. The Alice's email client will also renders the HTML.
MIME format (or say protocol, I prefer to use format, this is because it is like json, xml, which defines rules for structuring the data) is also used on World Wide Web for delivering web pages, images, pdf, by web servers to the web browsers.
I hope, here onwards, every time whenever you will hear MIME Post, you will remember the problem solved by MIME and how MIME Post fantastically defines what we do :)