You are not logged in.

#1 2024-02-08 08:45:36

gehenna14
Member
Registered: 2024-02-08
Posts: 42

[solved] Unable to get html email to show up in browser in Neomutt

I set up mailcap for Neomutt in order to show html emails in Lynx. I followed the instructions on (neo)Mutt's arch wiki page detailing setting up mailcap but when I open Neomutt and open a html- based mail in my indox it only brings up the html source code instead (like how it would show if I had never set it up in the first place).
Did I do something wrong?

~/.config/neomutt/mailcap:

text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=%s.html; copiousoutput

~/.config/neomutt/neomuttrc:

# urlscan
 macro index,pager \cb "<pipe-message> urlscan<Enter>" "call urlscan to extract URLs out of a message"
 macro attach,compose \cb "<pipe-entry> urlscan<Enter>" "call urlscan to extract URLs out of a message"

#html
set mailcap_path   = ~/.config/neomutt/mailcap
auto_view text/html
alternative_order text/plain text/html

Thanks

EDIT: turning off

alternative_order text/plain text/html

seemed to fix it, however I wish to not default neomutt to html as this breaks some non html messages, for example since lynx does not support images the images no longer show up on plaintext emails. How can I default to plaintext without disabling this?

Last edited by gehenna14 (2024-02-10 10:28:39)

Offline

#2 2024-02-08 09:51:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

Have you tried not setting the path and using ~/.mailcap instead?
Do you have a ~/.mailcap or /etc/mailcap w/ closer parameters that might trump your ~/.config/neomutt/mailcap ?

Offline

#3 2024-02-08 09:58:07

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

Have you tried not setting the path and using ~/.mailcap instead?
Do you have a ~/.mailcap or /etc/mailcap w/ closer parameters that might trump your ~/.config/neomutt/mailcap ?

I do not, all of my neomutt configs are located in the same folder so there should not be anything overwriting it

I was editing the OP right as you replied:

Seems i'm clueless hmm , it appears to work just fine, It is most likely the set of html emails I was testing with that seemed to have confused me, but I am wondering how exactly I am supposed to fix these? are they different from the working ones? Sorry

I assume these emails were using a different encoding perhaps? I'm not too sure because they do appear to be written in html.

Offline

#4 2024-02-08 10:12:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

Do they show up wrong in lynx if you download and open them directly?
Tried links?

Can you post one of them (you can redact all private content, just the header and the tags are relevant - hopefully)

Offline

#5 2024-02-08 11:11:29

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

Do they show up wrong in lynx if you download and open them directly?
Tried links?

Can you post one of them (you can redact all private content, just the header and the tags are relevant - hopefully)

I saved it in a gui client and it was saved as .eml, when i changed the extension and opened it in Lynx  it looked fine for the most part, it was only a little bit malformed.
I don't believe its an issue with lynx as it would say at the top of the email if it was being viewed in Lynx

here is the malformed email:

<strong style='font-size:1.2rem;'>We noticed a login from a new device or location for algeria1992 and want to make sure it was you.</strong><br /><br /><ul style='font-size:1rem;'><li>Regional Location: ******</li><li>IP Address: ******</li><li>Device: Computer (Unknown)</li><li>Time: Thursday, February 8, 2024 1:57 AM UTC</li></ul>
If this was you: You're good to go. No action is required. If this was not you <a href=https://help.roblox.com/hc/articles/203313100-How-Do-I-Change-My-Password>Change your password</a>. You will be logged out of all your active devices except the one you are using at this time. <br /><br />Thank You,<br />The Roblox Team<br /><br /><a href=https://help.roblox.com/hc/sections/200831884-Protect-Your-Account>Learn More</a> | <a href=https://www.roblox.com/info/account-safety>Account Safety</a> | <a href=https://www.roblox.com/info/2sv>2-Step Verification</a> | <a href=https://www.roblox.com/info/help>Support</a><br /><br /><div style='color:#393B3D;'>Please do not reply to this message as the response will not be delivered to the originator.</div>

Offline

#6 2024-02-08 13:52:11

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

If you open the mail in mutt and press "v" you'll get to see the mediaparts and attachments.
Is it multipart and is there a txt/html part and is it that file?

Offline

#7 2024-02-08 19:03:35

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

If you open the mail in mutt and press "v" you'll get to see the mediaparts and attachments.
Is it multipart and is there a txt/html part and is it that file?

This is what shows up when I press v:

I     1 <no description>                                                                                                  [multipa/alternativ, 7bit, 10K]
  I     2 ├─><no description>                                                                                          [text/plain, quoted, us-ascii, 1.1K]
  I     3 └─><no description>                                                                                           [text/html, quoted, us-ascii, 9.3K]

It appears that the text/plan mediapart contains the same html code as the text/html media part. However it is formatted in the text/html mediapart instead.

EDIT: deleting the text/plan mediapart seems to fix Lynx not being able to recognise it, I most likely think that its just a formatting error on part of whoever sent it (in this case Roblox)
How do I show the text/html mediapart above the text/plan element?

Last edited by gehenna14 (2024-02-08 19:26:54)

Offline

#8 2024-02-08 21:58:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

reversing the "alternative_order text/plain text/html" to "alternative_order text/html text/plain" but that means you're preferring html mails - this is simpyl some bogus text mail (part) - though they differ in size?
Have you downloaded both and looked at them individually w/ less?

Offline

#9 2024-02-09 05:49:19

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

reversing the "alternative_order text/plain text/html" to "alternative_order text/html text/plain" but that means you're preferring html mails - this is simpyl some bogus text mail (part) - though they differ in size?
Have you downloaded both and looked at them individually w/ less?

Yes, the text/plain attachment appear to look exactly the same as it does in neomutt, when I open the plaintext one in neovim and the html one in lynx opening the latter in neovim just brings up a properly formatted html page.

Offline

#10 2024-02-09 07:32:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

they differ in size?
Have you downloaded both and looked at them individually w/ less?

Offline

#11 2024-02-09 09:00:58

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:
seth wrote:

they differ in size?
Have you downloaded both and looked at them individually w/ less?

Yes I have.
I just outputted them via cat and piped them into less, its the exact same as when I looked at them in Neovim (html one is formatted correctly, plaintext one is squashed)
I do not know html so I am unable to tell whether these mean anything, BUT the .html file has all of its CSS info and header data at the beginning of it, which I assume is why it is 9kb compared to the plaintext.

I most likely did not notice it earlier, i'm really sorry about that sad

Last edited by gehenna14 (2024-02-09 09:01:49)

Offline

#12 2024-02-10 10:27:28

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

Sorry if i upset you, I didn't mean it sad (maybe it was me bolding the text?)

I set

alternative_order text/plain text/html

to

alternative_order text/html text/plain

and this seems to have done the trick for the most part.
looking into more emails quite a lot of them seem to have html attachments, just that the text/plain attachments are not malformed. So in the end I think this is probably the closest im gonna get.

Last edited by gehenna14 (2024-02-10 10:29:32)

Offline

#13 2024-02-10 10:40:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,551

Re: [solved] Unable to get html email to show up in browser in Neomutt

I'm not upset, I did't even see the markup but only the text in a mail.
The problem was kinda explained because you had simply gotten some bogus mails that had html code in the text/plain part - that's a strict sender problem for mis-encoding the mails.
I just wanted to make sure that you had taken a look at the raw data, w/o any interpreter (lynx) involved.

The reversed order has the (subjective) drawback that if you get multipart mails, you'll see the html part instead of the text part.
There's no good "solution" to the original problem because there's indeed nothing to solve - if you get a text/plain mail that has html markup in it, you should see the plain text, including the markup.
Otherwise it'd eg. not be possible to read html code that gets quoted in a mail (except it the sender had properly embedded it in a html mail)

You could configure an external pager that first runs a heuristic on the plain text (does this look like html) and handles it accordingly, "man muttrc", but that has several drawbacks even if we ignore that you're deliberately misrepresenting the actual mail text.

Offline

#14 2024-02-10 14:35:12

gehenna14
Member
Registered: 2024-02-08
Posts: 42

Re: [solved] Unable to get html email to show up in browser in Neomutt

seth wrote:

I'm not upset, I did't even see the markup but only the text in a mail.

Oh ok my bad, i'm not very good at reading the room , sorry.

seth wrote:

You could configure an external pager that first runs a heuristic on the plain text (does this look like html) and handles it accordingly, "man muttrc", but that has several drawbacks even if we ignore that you're deliberately misrepresenting the actual mail text.

The plaintext part looks like html so it could work, but I would rather not have to send something over to an external program for viewing mails, especially if I'm unable to choose which plaintext mails get sent through the pager (I only skimmed through muttrc's man page so I might be missing something relating to keybinds or whatever)

seth wrote:

The reversed order has the (subjective) drawback that if you get multipart mails, you'll see the html part instead of the text part.
There's no good "solution" to the original problem because there's indeed nothing to solve - if you get a text/plain mail that has html markup in it, you should see the plain text, including the markup.
Otherwise it'd eg. not be possible to read html code that gets quoted in a mail (except it the sender had properly embedded it in a html mail)

Well in that case i guess theres no helping it really, would rather view my emails in plaintext than in html (its faster), seems to only be Roblox who has been sending the weird emails.

Offline

Board footer

Powered by FluxBB