Do I have to expect any problems on the recipientsʼ side if I started sending single-part emails as Content-Type: text/markdown; charset=UTF-8;
according to RFCs 7763 and 7764? I believe it should fall back safely to the default text/plain
.
There are several ways email clients can support Markdown/Commonmark or related languages. I'm talking about transmission and the resulting display here.
Input
- Convert asterisks, underscores etc. the user inputs with their keyboard to HTML tags (or, in theory, any other rich text format) and send the email as a multipart message with
text/plain
andtext/html
. - Like above, but also offer GUI buttons or keyboard shortcuts (e.g.
foo
+ CtrlI ⇒_foo_
) to aid the input of these formats. This is basically a rich text editor that generates a better plain-text fallback than most do currently.
Both of these can use no, inline, side-by-side or before-submission previews of the rendered text.
This is what plugins like Markdown Here can do and some (web)mail clients support natively, e.g. Airmail, Mail Mate, Mailspring, Gmelius, Cypht. Some newsletter, admin, ticket or shop systems that send out emails themselves can also handle markdown input in this way.
Transmission
- Send single-part messages as
text/markdown
instead of the standardtext/plain
, relying on graceful fallback to the latter. This is what I'm asking about! - Send multi-part messages with
text/markdown
instead oftext/html
, basically duplicating thetext/plain
message body. - Send multi-part messages with generated
text/html
andtext/markdown
instead of the usualtext/plain
basic version.
Mail Mate and Groups.io may add a header parameter like this:
Content-Type: text/plain; format=flowed; markup=markdown
Display
- Display received single-part mails that have the appropriate
text/markdown
header set as plain text, as if it weretext/plain
. This is the expected graceful fallback. - Display received single-part or multi-part mails that have the
Content-Type
header set with atext/markdown
type ormarkup=markdown
parameter as rich text with the formatting characters removed. - Display received single-part mails that pass some heuristics to determine they were written according to Markdown or some other LML conventions as rich text with the formatting characters possibly being kept.
Many clients, e.g. Apple Mail, support rich text rendering of a single Markdown feature: block quotations with (possibly nested) >
at the beginning of the line.
Best Answer
Markdown has been implemented in various ways and flavors. Wikipedia lists Standard, CommonMark, GFM and Markdown Extra, but each implementation of even the same standard may give different results for the same markdown text (example).
In spite of the new RFCs, there is no official standard type for email, but
text/markdown
seems to be the most common de facto type. Most browsers and other reasonably sophisticated clients will likely see thetext/
part and default totext/plain
anyway, so there's not much difference as regarding email.If you take a look at the Markdown Implementations list, you will see that not even one email client or server is included in it.
There are websites that will convert your markdown to HTML and send the email for you, for example the commercial Gmelius, and PHP also has some markdown modules, but converters is the most you may expect.
According to comments by @grawity, among the email clients he tested, only Thunderbird passed it on as Raw data to be displayed. The others have simply lumped the Markdown inside an attachment. This means that only Thunderbird paid attention to the
text/
part in Content-Type, while the others only treated the entire MIME specification, which to them was unknown since they don't understand Markdown.I don't really think that as things stand today using Markdown is a good idea, as the wave of markdown incorporation has not reached the email clients and may never do. In any case, according to the
w3.org
link above, no email client handles it correctly, so there's really no point it.