Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to be able to convert HTML email messages saved as text files (.eml or .msg) to PDF documents, one PDF per email, retaining formatting and images.

Are there any Linux tools that will allow me to do this from the command line (so it can be scripted)?

share|improve this question

closed as off-topic by DavidPostill, Nifle, Kevin Panko, Moses, mdpc Feb 6 at 3:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – DavidPostill, Nifle, Kevin Panko, Moses, mdpc
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 3 down vote accepted

.eml files are just text files, so you can print them using standard methods.

The easiest utility for text conversion is arguably Pandoc. This utility should cover any html email as well, although you'll want to specify the format manually since .eml isn't very standard when it comes to text data.

pandoc -f html -o outputfile.pdf inputfile.eml

share|improve this answer
Pandoc didn't work for me, I encountered pandoc: Error producing PDF from TeX source even after installing 1GB of dependencies. I instead used MHonArc which was easy to use too and available in most all package installers. apt-get install mhonarc' and then you can convert an entire mailbox/folder or even a single file like mhonarc -single somemailfile > converted.html` – TryTryAgain Nov 4 at 20:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.