choices on reading HTML emails

mwnx mwnx at gmx.com
Tue May 15 20:21:58 UTC 2018


On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:
> Hi,
> 
> Can anyone share some approaches for reading HTML emails.
> Currenlty I use w3m:
> 
>     text/html; w3m -I %{charset} -T text/html; copiousoutput;
> 
> But sometimes I receive some HTML mails which can not be handled that well by
> w3m, so I want to open that html attachment in a browser. How can I switch
> between?
> 
> Yubin

I find that the best way to handle such mail is to "pipe" it into
thunderbird (no configuration needed). This has two advantages:

- Thunderbird knows how to handle embedded images and the like.

- Safety. Opening an html email with firefox may leak information to
  the likes of spammers since firefox will attempt to load external
  resources (images) without asking, while thunderbird takes these
  issues into consideration.

Here's the binding I use in my muttrc:

    macro index,pager,compose ,o "<pipe-message>thunderopen<enter>"

When I need to open an email with thunderbird, I just press `,o`.

And here's the `thunderopen` script, which I place in `~/bin/`:

----
#!/bin/bash
# Open an email file from stdin with thunderbird. Useful with mutt's
# pipe-message command.

set -eu

tmp=
trap 'rm -f "$tmp"' EXIT
tmp=$(mktemp --tmpdir thunderopen-XXXXXXX.eml)

cat > "$tmp"
thunderbird --no-remote --new-instance -file "$tmp"
----

One drawback of this method, to which I haven't yet found a fix, is
that you can only open one page at once or thunderbird will complain
about an existing instance. I'm pretty sure there must be some
option to force a new instance, or, in the worst case, it should be
possible to containerize thunderbird to make it unaware of other
instances.

-- 
mwnx
GPG: AEC9 554B 07BD F60D 75A3  AF6A 44E8 E4D4 0312 C726


More information about the Mutt-users mailing list