Discussion:
Want to auto_view html, but try text/plain first
Manish Rai Jain
2018-10-21 16:29:42 UTC
Permalink
Hi all,

I'm trying to render the HTML attachments in my email automatically, using
auto_view. However, I also use alternative_order so it would render any
text/plain attachment first, and only if it is not present, would it render
HTML. Here's my config:

.muttrc
# Viewing
auto_view text/html
alternative_order text/plain text/enriched text/html

.mailcap
text/plain; cat %s; copiousoutput;
text/html; google-chrome-stable %s; nametemplate=%s.html; copiousoutput;

I also tried setting auto_view to text/plain text/html. But, that just
causes both text and html to render. What am I doing wrong?
Cameron Simpson
2018-10-21 22:56:12 UTC
Permalink
Post by Manish Rai Jain
I'm trying to render the HTML attachments in my email automatically, using
auto_view. However, I also use alternative_order so it would render any
text/plain attachment first, and only if it is not present, would it render
.muttrc
# Viewing
auto_view text/html
alternative_order text/plain text/enriched text/html
.mailcap
text/plain; cat %s; copiousoutput;
text/html; google-chrome-stable %s; nametemplate=%s.html; copiousoutput;
I also tried setting auto_view to text/plain text/html. But, that just
causes both text and html to render. What am I doing wrong?
I'm not sure what your trying to fix. It sounds like you only one one to
render, but not always the plain in preference to the html.

I maintain a group containing authors who provide useless plaintext
accompaniments, and whose html is the only useful version. Sadly, there
are quite a few.

My muttrc has this:

############################
# alternative-order criteria
message-hook . 'unalternative_order *; alternative_order text/plain text/html'

# Apple Mail embeds attachments in the HTML part instead of outside
# the multipart/mixed
message-hook '~h "X-Mailer: Apple Mail" ~X 1-' 'unalternative_order *; alternative_order text/html multipart/mixed text/plain'

# senders who can't seem to master multipart/mixed, and send empty or
# useless text/plain sections
# or just badly badly formatted plain text, such as live.com etc
message-hook '%f htmlers | ~f @no-***@cc.yahoo-inc.com | ~f @outlook.com | ~f live.com | ~f @facebookmail.com' 'unalternative_order *; alternative_order text/html text/plain'

so my default is plain text in preference, but for some expections where
I swap things.

Cheers,
Cameron Simpson <***@cskk.id.au>
Cameron Simpson
2018-10-22 01:02:37 UTC
Permalink
Post by Cameron Simpson
I'm not sure what your trying to fix. It sounds like you only one one
to render, but not always the plain in preference to the html.
Wow, that is nearly unintelligible. I'm feeling pretty blah today. That
_should_ read:

I'm not sure what you're trying to fix. It sounds like you only want
one to render, but not always the plain in preference to the html.

Apologies,
Cameron Simpson <***@cskk.id.au>
Manish Rai Jain
2018-10-22 02:47:56 UTC
Permalink
Sorry, if it wasn't clear from my mail. I want HTML to render automatically
in chrome iff there's no text/plain present. Maybe I'm missing the
`unalternative_order *`, will try that out.
Post by Cameron Simpson
Post by Cameron Simpson
I'm not sure what your trying to fix. It sounds like you only one one
to render, but not always the plain in preference to the html.
Wow, that is nearly unintelligible. I'm feeling pretty blah today. That
I'm not sure what you're trying to fix. It sounds like you only want
one to render, but not always the plain in preference to the html.
Apologies,
Manish Rai Jain
2018-10-22 02:55:52 UTC
Permalink
unalternative_order * doesn't help. The problem is that, mutt always
renders html (in my case, it gets sent to chrome which introduces a delay)
via mailcap, if I set text/html in auto_view. I only want html mailcap to
be invoked, if text/plain isn't present.
Cameron Simpson
2018-10-22 05:29:18 UTC
Permalink
Post by Manish Rai Jain
unalternative_order * doesn't help. The problem is that, mutt always
renders html (in my case, it gets sent to chrome which introduces a delay)
via mailcap, if I set text/html in auto_view. I only want html mailcap to
be invoked, if text/plain isn't present.
Ah, I think I understand.

The unalternative_order in my config is just necessary to scrub the old
order and install a different one. Not what you need.

I think the problem is that auto_view is unconditional. So it fires
whether there's a plain text version or not.

- comment out your auto_view

- you can drop the text/plain mailcap entry, mutt will do that just fine

- retry

That _should_ get you a chrome window if there's no text/plain, if I
understand what's going on.

Cheers,
Cameron Simpson <***@cskk.id.au>

Continue reading on narkive:
Loading...