The Holy Grail of Mail-to-PDF Conversion

The Holy Grail of Mail-to-PDF Conversion

Perhaps the title of this post is overblown, but I’ve long wanted to be able to automatically create PDFs from email messages and although I’ve searched high and low the solution has eluded me—until now.

OS X applications can create a PDF from a document when they’re printed, and Mail is no exception: simply choose File > Print when a message is selected and then choose Save as PDF… from the PDF menu in the lower right corner of the Print sheet.

Print to PDF

But how do you automate this? Mail rules don’t have a “Print Message” action and printing isn’t scriptable in Mail. Although it’s possible to use AppleScript to extract the text from a message and then use a shell script to print using TextEdit as an intermediary, this doesn’t work for HTML messages. My goal was to create a PDF of the message exactly as it looks in Mail: text, formatting, images, and all.

While I was discussing DEVONthink’s inability to display archived email exactly as received, a DEVONtechnologies forum member pointed me to Email Archiver [Mac App Store, $20]. The app isn’t new, having been released in October 2010, but this was the first I’d heard of it.

Email Archiver creates a PDF for each of your email messages; you give it a list of folders to watch or drag one or more messages to the app and the PDFs are created in a destination folder of your choice. Attachments are copied to a folder with the same name as the PDF and all are organized in the same manner as your Mail folders, with the original messages and attachments left in place.

My only complaint with the app is that once I launched it and chose a destination, Email Archiver immediately began scanning my Mail folders (at ~/Library/Mail)—not at all what I wanted it to do and not what you would expect since the Start archiving emails on launch preference was disabled by default. If you plan on archiving only some of your email messages (as I do), you’ll want to immediately click the Stop button in the main window, then open the preferences and change the source folders.

Additional options exist to exclude specific folders; archive only while your Mac is idle; and use Windows-compatible file names. File names are a combination of the date and time of the message and the subject; that last preference eliminates characters that Windows doesn’t allow for files.

Email Archiver adds the message headers to the PDF (in a very tiny font) and your PDFs are fully searchable using Spotlight (the app also includes a search feature).

Since I only want to convert specific messages, a couple more steps are necessary to automate this process.

First, created a new, On My Mac mailbox called “Archive to PDF” and specified this folder as a source folder in Email Archiver. Then I created a Mail rule to move specific messages to the folder.

Email Archiver Mail Rule

When Email Archiver is running any new messages added to the “Archive to PDF” folder will now be converted to PDF. I’ll be playing with the workflow and figure out how to streamline the organization (perhaps move the PDFs into DEVONthink) and delete the original messages; if you’ve got some suggestions, feel free to hit me up on Twitter.

Update: I’m somewhat miffed that, after having purchased the Mac App Store version on faith, I found that Email Archiver has a trial version and can be purchased outside the MAS. I didn’t know this at the start, because the developer’s website has only the MAS link. The app is also sold through Ironic Software, another company owned by the developer, but it didn’t show up there until October 2012—shortly after I last perused the site. (Ironic sells it as Email Archiver PRO, but the version number is the same as the MAS version.) And there’s yet another website for the app which gives instructions for using the app with Outlook 2011 for Mac. However, the app isn’t in MacUpdate.com, where one might expect to find it. Confusing.