Re: Suggestions for mail client

From: Bob Proulx <bob_at_proulx.com>
Date: Sat, 21 Sep 2024 22:01:44 UTC
Karl Vogel wrote:
> Darius Rosotic wrote:
> > In this file I have this code to say that I want "HTML" attachments
> > opened with Firefox:
> > 	text/html; /usr/local/bin/firefox ...
>
> In my mailcap file, I use this for inline viewing of HTML:
>   text/html; /usr/local/bin/lynx -dump %s; nametemplate=%s.htm; copiousoutput
>
> I can also see images in a separate window:
>   image/*;   /usr/local/bin/feh %s

I only object to the full hard coded paths there making that a
non-portable mailcap file.

In my ~/.mailcap file I have all of the text mode html dumpers
commented with my currently preferred one uncommented.  As time goes
by and depending upon the html one will do a better rendering job than
another one will on different types of html.  I am preferring "links"
at the moment but as you can tell I select among the selection as my
whims dictate.

    # text/html; firefox %s; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
    # text/html; elinks -dump -dump-color-mode 3 %s; copiousoutput; description=HTML Text; nametemplate=%s.html
    # text/html; elinks -dump %s; copiousoutput; description=HTML Text; nametemplate=%s.html
    text/html; links -dump %s; copiousoutput; description=HTML Text; nametemplate=%s.html
    # text/html; lynx -force_html %s; needsterminal; description=HTML Text; nametemplate=%s.html
    # text/html; lynx -dump -force_html %s; copiousoutput; description=HTML Text; nametemplate=%s.html
    # text/html; w3m -no-mouse -T text/html %s; needsterminal; description=HTML Text; nametemplate=%s.html

If this does not produce something reasonable for me then I 'v'iew the
mime parts, j and k down to the text/html part, 's'ave it to a file
usually for me ~/tmp/mail.html (selecting overwriting of the previous)
and then in my running Firefox I click my toolbar bookmark to open the
file:///home/rwp/tmp/mail.html bookmark which renders the email
message in the full html web browser.

I like this strategy because most of the time if I must view the
text/html part then one of links, elinks, lynx, w3m will do a good
display of it.  I can read it and move along.  But for those pesky
HTML emails that don't render that way or that require my input I can
transfer the file to the web browser and handle it there.

Additionally I also have image and pdf entries too.

    application/pdf; /usr/local/bin/xpdf %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf
    application/x-pdf; /usr/local/bin/xpdf %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf
    application/pdf; pdftotext -layout %s -; copiousoutput; description=Portable Document Format; nametemplate=%s.pdf

    image/gif; feh -FZ '%s'; test=test -n "$DISPLAY" ; description=GIF Image; nametemplate=%s.gif
    image/jpeg; feh -FZ '%s'; test=test -n "$DISPLAY" ; description=JPEG Image; nametemplate=%s.jpeg
    image/png; feh -FZ '%s'; test=test -n "$DISPLAY" ; description=PNG Image; nametemplate=%s.png

Plus some other useful ones.

    text/plain; less %s; needsterminal
    text/x-diff; cat; copiousoutput

    application/msword; catdoc %s; copiousoutput; description="MS Word Text";

    application/vnd.ms-excel; libreoffice %s; edit=libreopenoffice '%s'; test=test -n "$DISPLAY"; nametemplate=%s.xls; description="Microsoft Excel Document"

Sometimes I get an email with atypical types and create an entry on
the fly and then use it.

I test for $DISPLAY so that when I log into my system remotely using
ssh rather than being on my desktop console that the best available
entry is automatically selected.  I get text only options when
$DISPLAY is not set.  I get graphical choices.

Bob