(Neo)mutt fuckery with multipart messages

Posted by Wxcafé on Tue 03 July 2018

I’ve been using Mutt, and then Neomutt, as an email client on my laptops for a while (I generally use Evolution on my desktop, because it runs on GNOME, while the laptops run on i3wm). Today while talking with colleagues who also use a TUI, text-only email client, we realized we had one shared pain about this, which was receiving multipart emails where the text/plain part was either the HTML source of the text/html part or a single line saying “This email has no plain text version, refer to the HTML version” (If you don’t know how multipart emails and MIME work, wikipedia has a good primer).

We thought it might be fun as retaliation to send multipart emails, with the text/html part saying “This email has no HTML version, please refer to the plain text”. An hour and a few curses at mutt’s documentation later, I’d come up with this solution:

First, create the HTML document:

<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type="text/css"> body { margin : 40px auto;
                                   max-width : 650px;
                                   line-height : 1.6;
                                   font-size : 18px;
                                   color : #444;
                                   padding : 0 10px
                            h1,h2,h3 { line-height : 1.2
      Sorry, this email is not available in HTML<br/>
      Please refer to the plain text version!

and put it in ~/.mutt/multipart.html

Then we simply need to add to our .muttrc this line:

send-hook ~A "push 'a~/.mutt/multipart.html<enter>'\CDkTT&"

This is a send-hook that will match any outgoing email, add the html file as an attachement, then tag it as inline, tag both parts of the message and merge them into a multipart/alternative file (The & command only exists in ~recent (May 2, 2018) versions of neomutt).

You can now do anything you’d normally do with the email, add further attachements, PGP sign it (or not), add ccs, whatever. When you send the email, it will be sent as a multipart/alternative message with the HTML document we set earlier as the text/html part and your message as the text/plain part, and basically every graphical client will only display the HTML version.

Sample fuckery:

example of the same email message opened in mutt and

P.S.: I know I shouldn’t have to say this but please don’t actually use this to annoy people who use graphical email clients. We’re the weird ones, basically everyone uses a graphical email client, and they’re clearly the standard now, plus it’s clearly a dick move to do this. Please refrain. Thank you for your understanding ❤️