/mimedown

markdown to multipart mime

Primary LanguageCISC LicenseISC

Markdown to multipart MIME

Answering the age-old debate: HTML or plaintext emails? Both!

Write email in markdown, and convert to multipart MIME that works impeccably in graphical and console mail clients.

  • Creates a conservative ISO/IEC 15445:2000 HTML representation, which is set as the preferred multipart alternative for graphical clients.
  • The text alternative is reflowed at 72 characters to look good in standard console mail readers.
  • The text part also uses format=flowed, so it will shrink on narrow screens or terminal splits.
  • Fenced code blocks in the markdown are added as inline attachments with the appropriate MIME type. This makes them easy to download/save from the message.
  • URLs are listed at the bottom of the text message in a special text/uri-list inline attachment, and referred to with short codes like [0], [1] ... in the message text.

Installation

Written in portable C99. The only requirement is the cmark library to parse markdown.

# detect cmark and set up build flags
./configure
# then build md2mime
make

Usage

./md2mime sender-domain.com < message.md > message.email

The sender domain is required to generate a good Message-ID.

If the original message starts with headers, pass -p to preserve them. Send the message using a program like msmtp:

msmtp recipient@example.com < message.email