Pretty print mails from mutt

muttprinting

I know that I can configure a print command in Mutt via .muttrc, e.g.:

set print=ask-yes
set print_command="..."

But what print command should I use for pretty printing?

Well, a2ps output seems a little bit spartan, even with the -=mail shortcut. It does not support UTF8. There is paps which is described as 'UTF-8 to PostScript converter using Pango' and currently does not include support for margins, or Email layout or something like that.

mp: nice default header. Again no UTF8 support. Default margins are ridiculously small – if you specify wider margins the body text is printed behind the footer.

enscript: -G for fancy page headers is indeed fancy. No UTF8 support.

What do you use in the 21st century to print your mails from Mutt?

(It should support UTF8, DIN A4 output as PS and/or PDF)

Best Answer

There is also Muttprint. It does support UTF-8 and its output looks decent by default. Muttprint uses LaTeX and provides hooks for customization.

Since I am printing mails from different environments I can't use a default printer. Thus I have set it up (via ~/.muttrc) to use a PDF viewer where I can dynamically select a printer:

set print_command='set -e; f=`mktemp`; \
        muttprint -P A4 -p TO_FILE:"$f"; evince "$f"; rm "$f"'

Mktemp uses /tmp, by default. For using a custom cache directory:

set print_command='set -e; f=`mktemp -p "$HOME"/.cache/mutt`; \
        muttprint -P A4 -p TO_FILE:"$f"; evince "$f"; rm "$f"'

Btw, you can set print_decode inside muttrc to configure if the print_command is able to decode MIME, encodings etc. on its own. By default it is set to yes which is the right setting for commands like muttprint, enscript etc.

Regarding the UTF-8 issues of a2ps, enscript and mp one can just conclude that they should be considered obsolete. Indeed, looking at the project pages they don't seem to be maintained (e.g. last news item of the mp page is from 2002 and it mentions a mailing list located at Sun).

Related Question