You are not logged in.

#1 2022-09-25 01:49:28

Salkay
Member
Registered: 2014-05-22
Posts: 682

[SOLVED] View html mail from (neo)mutt

For years I've been using this script to view html mail from neomutt. This opens the mail in my web browser, allowing me to view formatting and embedded images. However, it's the only thing on my system that needs Python 2, and thus I am looking for alternatives. I know there are other possible solutions, but none of these allow me to view embedded (attached) images.

Does anyone have a good method that doesn't need Python 2?

Last edited by Salkay (2022-09-25 06:50:30)

Offline

#2 2022-09-25 02:12:34

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] View html mail from (neo)mutt

mailcap


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2022-09-25 02:15:21

Salkay
Member
Registered: 2014-05-22
Posts: 682

Re: [SOLVED] View html mail from (neo)mutt

jasonwryan wrote:

mailcap

That's the solution from your blog that I linked, right? I haven't tried this for a few years, but I'm 95% sure this doesn't display embedded (attached) images. Hence why I used the script as per my post.

Offline

#4 2022-09-25 02:35:34

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: [SOLVED] View html mail from (neo)mutt

Salkay wrote:

... but I'm 95% sure this doesn't display embedded (attached) images

I'm 100% sure it does (or can ... if your selected browser doesn't display images, that's a different problem).

Last edited by Trilby (2022-09-25 02:36:58)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-09-25 03:03:00

Salkay
Member
Registered: 2014-05-22
Posts: 682

Re: [SOLVED] View html mail from (neo)mutt

Trilby wrote:

I'm 100% sure it does (or can ... if your selected browser doesn't display images, that's a different problem).

Ah okay, I went back to the original blog post, and now I remember why I didn't test this route. I was originally looking for a solution with Firefox, whereas the link uses Vimprobable. In any case, that solution links to another of Jason's pages on how to install Vimprobable... but it's just full of broken links.

Unfortunately I don't understand the code well enough to transfer it to Firefox. I did retest the solution from the wiki using iconv, but this indeed does not display attached images. The python 2 solution still works, so I'm assuming that Firefox is working as expected.

Offline

#6 2022-09-25 03:43:01

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] View html mail from (neo)mutt

Yeah, my blog hasn't been updated in years... tongue

My point was you don't need a script at all. Just a correctly configured mailcap entry will hand off the HTML to Firefox (or whatever browser you choose).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2022-09-25 04:08:23

Salkay
Member
Registered: 2014-05-22
Posts: 682

Re: [SOLVED] View html mail from (neo)mutt

jasonwryan wrote:

Just a correctly configured mailcap entry will hand off the HTML to Firefox (or whatever browser you choose).

I do have the following in ~/.mutt/mailcap

text/html; firefox -new-tab %s; test=test -n "$DISPLAY"; nametemplate=%s.html

If I use this, the html does open in Firefox, except attached images are missing. It's plausible that the email architecture has been mangled by the sender's email client, but either way the python 2 way does work for the email I'm testing with.

Offline

#8 2022-09-25 06:26:09

positronik
Member
Registered: 2016-02-08
Posts: 95

Re: [SOLVED] View html mail from (neo)mutt

In your post you link to a blog so I am not sure which script you are currently using. Is it actually this one?

If that's the case are you sure it's not working on python 3? The shebang at the beginning of the file does not specify python 2.
Also, if you want post here the error you get with python 3 and I might be able to help.

Offline

#9 2022-09-25 06:49:45

Salkay
Member
Registered: 2014-05-22
Posts: 682

Re: [SOLVED] View html mail from (neo)mutt

positronik wrote:

In your post you link to a blog so I am not sure which script you are currently using. Is it actually this one?

If that's the case are you sure it's not working on python 3? The shebang at the beginning of the file does not specify python 2.

Ahhh! Thank you so much @positronik. Great detective work.

Yes, that blog originally linked to a python 2 script. However, as you noticed, the link was dead. Since the blog post was not updated, I wrongly assumed there was no new version for python 3.

You are correct. The new script you linked does indeed work in python 3! Currently it uses "quickbrowse" for the web browser, but just above this is a commented-out line to use Firefox instead. After changing it, this script now works perfectly, and I can happily uninstall python 2. Thank you again!

Offline

#10 2022-09-25 12:52:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: [SOLVED] View html mail from (neo)mutt

Aside, I just learned of the "nametemplate" option in mailcap due to this post.  That's awesome and saves from some gymnastics I had been doing due to my browser not rendering html in a file without an extension.  EDIT: I don't see this in the man pages, though it is documented in RFC 1524.

Last edited by Trilby (2022-09-25 12:56:57)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB