Mutt using elinks to color html and external pager dilemma

7

1

These days more and more HTML emails are being unsed. Unfortunately making mutt render html in color via elinks works only partially due to the fact that the internal pager of mutt overwrites the color codes coming from the external tool. To overcome this i'm using an external pager:

In my .mailcap

text/html; elinks -dump -dump-color-mode 3 \
    dump-charset utf-8 -default-mime-type text/htm %s; \
    copiousoutput

and in .muttrc

set pager=more
auto_view text/html

However now the pager doesn't display any non-html email which makes it unusable.

I'd like to know if there is a way to either

  • Make the external pager render non-html email. (I don't understand why this doesn't work off the bat.)
  • Use the external pager selectively only for .mailcap designated types. (Piping the output of elinks to more won't work as the output is being filtered by the internal pager.)

count0

Posted 2015-06-17T15:24:28.917

Reputation: 181

Did you ever manage to solve this? Also, how did you find out that mutt wipes the colour codes from external tools? I wonder if there's a way to override that, as I'd much prefer reading mail within mutt rather than opening up another window. – Sparhawk – 2016-02-11T00:19:51.087

@Sparhawk: no i havent. As you can see no activity here. Maybe start a bounty ? – count0 – 2016-02-11T19:41:20.907

Finding the sequence of processing the color codes was some online research followed by trial and error. To be honest having the pager setup globally instead of via mailcap is the root of the problem. What i was looking for was a function which would pass enough data to the pager backend so it could be wrapped by a custom program. – count0 – 2016-02-11T19:50:15.437

I wouldn't start a bounty because my preferred way to read is staying in mutt. If I had to open an external pager, I'd just as well open a new page in Firefox. It's a pity that it strips colour codes, though. That seems unnecessary. (I sometimes get emails with "my replies are in red".) – Sparhawk – 2016-02-16T04:00:24.377

Does set allow_ansi="yes" help? I find that works for ANSI terminal codes in text emails but gets a little scrambled on paging. See the manual for possible security implications. – Karl – 2016-08-16T07:25:49.553

The colour scrambling was due to cron emails not having a content-type. text/plain fixed it. – Karl – 2016-08-26T00:34:18.237

Have you considered alternative_order to handle your non-html emails? – clem steredenn – 2017-12-13T10:53:58.813

No answers