Saving a Maildir email as .eml using Mu4e
(This was originally published at baty.net but I wanted a copy here, also)
I use Emacs and Mu4e for managing email. Normally having all of my email as text files in Maildir format is fine. There are times, though, when I want to save a copy of an email and put it in DEVONthink with everything else. DEVONthink handles email very well, meaning it previews the headers separate from the messages and formats things nicely. The problem is that this only works with .eml files.
Both Maildir and .eml files are plain text, so I took a guess and added .eml to the end of a stock Maildir file and it worked. The file was easily preview-able in the Finder and DEVONthink thinks it’s a normal email message. The challenge then, was to figure out an easy way to copy whatever email I’m viewing in Mu4e to a .eml file somewhere.
I have no experience writing lisp so I asked on the mu mailing list and soon received a reply from Mu4e’s author, Dirk-Jan Binnema (‘djcb’). He sent this:
I added that to my init file and assigned it to . Now, when I’m reading an email and want to save a copy, I just hit and (optionally) enter a directory and the message is saved as a .eml file named using the email’s date and subject. Very handy!