choices on reading HTML emails
Akkana Peck
akkana at shallowsky.com
Tue Apr 10 16:46:08 UTC 2018
> On Tue, Apr 10, 2018 at 03:57:53PM +0800, Yubin Ruan wrote:
> >
> > 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?
Chris Green writes:
> I have similar, my .mailcap is:-
>
> text/html; /home/chris/bin/muttfox %s
> text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
>
> So I use lynx to view HTML E-Mail by default and to view in my browser
> I hit v[iew-attachment] and then 'm' for view-mailcap to view using my
> muttfox script. The muttfox script just calls a local or remote
> firefox it's only necessary because I run mutt via ssh remotely
> someetimes. For normal use you can just call firefox directly.
I have several ways of dealing with different types of HTML,
though it starts with a mailcap like Chris':
text/html; mimehelper 5 firefox 'file://%s'; nametemplate=%s.html
text/html; lynx -term=xterm -dump %s; nametemplate=%s.html; copiousoutput
Mutt will automatically show html messages using lynx, but if I want
to see them in firefox, I use 'v' to see the attachment list, arrow
down to the attachment and hit return. mimehelper is a script that
runs a program then sleeps for 5 seconds, otherwise mutt often
removes the temp file before the browser has had a chance to read it.
I wish I could make mutt less aggressive about removing its temp files.
Then there's the case of multipart/alternative messages where the
text part (which I prefer in alternative_order) is broken; I don't
necessarily want to open the HTML message in a browser, I just want
to reverse alternative_order so I can see the HTML part it lynx.
I have a binding for that which I got from
http://www.archivum.info/comp.mail.mutt/2008-08/00002/Re-combined-html-ascii-message-mutt-shows-html-but-not-ascii.html
That still leaves the edge case of HTML mail with attached images.
I don't get those very often, but when I do, mutt can't show the
images. So I wrote a Python script that pulls out the cid:
attachments and saves them, then rewrites the HTML to point to them.
http://shallowsky.com/blog/tech/email/mutt-viewing-html-mail.html
Finally, I have a script that brings up a browser window showing all
the attachments, both HTML and Word docs (converted to HTML), in
different tabs. (I unfortunately have to correspond with a group of
people who insist on communicating by mailing bunches of Word
attachments). So I put that on F5:
macro index <F5> "<pipe-message>~/bin/viewmailattachments\n" "View all attachments in browser"
macro pager <F5> "<pipe-message>~/bin/viewmailattachments\n" "View all attachments in browser"
The script is at
https://github.com/akkana/scripts/blob/master/viewmailattachments
That one doesn't handle embedded images; some day I need to combine
viewmailattachments and viewhtmlmail into one script.
...Akkana
More information about the Mutt-users
mailing list