Hello! On Wed, Nov 24, 2021 at 05:21:10PM +0000, Jean Louis wrote: > * Anders Damsgaard <and...@adamsgaard.dk> [2021-11-22 12:05]: > > * Globe Trotter via Mutt-users <mutt-users@mutt.org> [2021-11-22 00:47:10 > > +0000]: > > > What is the recommended way to pretty-print mutt emails? I found a > > > sourceforge perl script called muttprint but that was last updated in > > > 2008, and I was wondering what folks here recommended? > > > > I use the following sh(1) script to format the message as troff and > > convert to pdf: https://adamsgaard.dk/tmp/muttprint-groff.sh > > > > It's a bit ugly in places, but it works for me. This is an example: > > https://adamsgaard.dk/tmp/muttprint-example.pdf > > > > I bind it in my muttrc with the following: > > > > set print_command="$HOME/.config/mutt/muttprint-groff.sh" > > Very nice. I find it simple and good. I would like to have the header > fields rather aligned to left side. > > When using grep, I think `grep -m1' should be used to find the first > match, as I wonder what would be the result if words like "From:" or > "Date: " are found in the body of the email, not only in the header. > > I also think I can convert your script to use Asciidoctor instead of > groff, https://asciidoctor.org/ -- so I will work on it.
I created a Go program for that use case a while ago: https://gnoack.github.io/mailprint/ I think I am the only user, but it works well for me. It is mostly tuned for the e-mails from the Linux kernel mailing list, so it'll print the mails as plain text, with syntax highlighting for git patches. It also has support for printing the senders' profile pictures from a ~/.picons directory [1]. The website has installation instructions and a screenshot. Under the hood, it is still a shell pipeline piping to groff. You can find some more technical background at [2]. –Günther [1] https://kinzler.com/ftp/faces/ [2] https://blog.gnoack.org/post/mailprint-design/