mu icon indicating copy to clipboard operation
mu copied to clipboard

mu4e-action-view-in-browser doesn't work with inline attachments...

Open avar opened this issue 9 years ago • 2 comments

...since it just takes the HTML part, saves it to /tmp/$random.html, and opens it.

I have some mails that have a HTML part, and then a bunch of attechments (e.g. 01.png, 02.png, ...) and reference those parts as <img src="cid:01.png@$CID"> where $CID is the content-id noted in the Content-ID header with the MIME attachment.

A simple approach that would work for this would be:

  • Save the HTML part to /tmp/$RANDOM/$name.html
  • Save all the attachments to the same /tmp/$RANDOM
  • Run s/^cid:(.*)(?:@[^@]+)$/$1/g on all the <img src="..."> fields

Just filing it here in case anyone's interested, or so others can point out any glaring flaws in this plan. Doing the above manually worked with some E-Mails I have.

avar avatar Jan 06 '16 14:01 avar

Perhaps this can be combined with https://github.com/djcb/mu/pull/750 ?

There are some function to save attachments (both mu and mu4e) that might help. Typically, we try to put each attachment in a separate directory, since they may not have unique names. Though cid:'s should do so. Perhaps we try to somehow disable javascript for the shown messages.

(In the 'mug' html-viewer I take a slightly different approach, by hooking the browser's requests for the cid: parts, and then delivering the images. But the approach sketched here is probably easier for the use-case.)

djcb avatar Jan 06 '16 17:01 djcb

Looks relevant, but FWIW I just get Wrong type argument: stringp, nil on the code posted in that pull request...

avar avatar Jan 12 '16 11:01 avar

Oh, in the mean time this got implemented (re-using the gnus functionality). Took a few years :-) Closing.

djcb avatar Nov 09 '23 13:11 djcb