Since the beginning of time email has supported plain text emails. Then HTML email was added, this made a lot of people angry and is widely regarded as a bad move.

But what if you could do something different? How about using markdown instead? It's simple enough that if the email client doesn't support it it should just be readable as a regular plain text email. Sadly once you start dealing with email clients you will start encountering the horrors of email software developers having different opinions on what email headers mean.

The simple test case

The most simple way to send a markdown message is probably just sending as a message with the text/markdown content type. For my tests I used this message:

From: info@postmarketos.org
To: martijn@brixit.nl
Subject: Markdown test
Mime-Version: 1.0
Content-Type: text/markdown

This is a *markdown* email. It might actually render
in email clients. Maybe it shows up as an attachment.

And then sent it off using the sendmail command:

$ sendmail -t < test.eml

Since a lot of people use webmail, let's see how Gmail handles it first:

Well... That's not a great start. It renders as an attachment. Same with the Android Gmail client. At least it's consistent.

Lets see if Thunderbird fares better:

This is an interesting one. It half-renders as markdown by applying the emphasis but not removing the actual markdown markup. Let's pick a more modern Linux mail client; Geary. It seems to handle text/markdown basically the same way as Gmail.

For text email clients my favorite is definetly AERC. Let's see what happens:

It's... eh... readable

At least it displays the message. Now, our challenger from the KDE side: KMail

KMail seems to have the same message handleing as Thunderbird in this case.

Content-Disposition

Some mail clients are rendering the text/mail message as an attachment. Normally IF MAILCLIENTS FOLLOWED ANY SPECS the way parts are rendered would be dependent on the Content-Disposition header. This tells the mail client wether a part is intended as an attachment and which filename it has, or wether it's supposed to be inline. Since it's not rendered inline for mailclients let's try adding this header making the test mail this:

From: info@postmarketos.org
To: martijn@brixit.nl
Subject: Markdown test
Mime-Version: 1.0
Content-Type: text/markdown
Content-Disposition: inline

This is a *markdown* email. It might actually render
in email clients. Maybe it shows up as an attachment.

First let's try Gmail again:

No improvement really. After some testing Thunderbird, Geary, AERC and KMail also seem to completely ignore this header.

markup=markdown

It seems like somebody tried this almost 10 years ago and tried to add an extra markup=markdown field in hopes of having other mail clients adding support for it. Let's see if this has happened. Since with this way the Content-Type is text/plain I suspend a lot of mail clients will just render it as plain text.

From: info@postmarketos.org
To: martijn@brixit.nl
Subject: Markdown test
Mime-Version: 1.0
Content-Type: text/plain; charset=utf8; markup=markdown

This is a *markdown* email. It might actually render
in email clients. Maybe it shows up as an attachment.

The results:

Yes, It renders as text/plain. Thunderbird still renders it has half-markdown and Geary also renders as text/plain:

For KMail the result is the same as Thunderbird again:

And for AERC we have....

Hmm right. It follows some standards at least. Let's fix that typo first.

Exactly the same handleing in all cases basically.

Conclusion

Just write your markdown as text/plain, email clients are broken.