<<< Date Index >>>     <<< Thread Index >>>

Re: Viewing HTML messages with images



On 2007-08-31, Kai Grossjohann <kai@xxxxxxxxxxxxxx> wrote:
> On Thu, Aug 30, 2007 at 11:34:57PM -0500, Matt Okeson-Harlow wrote:
> 
> > w3m can be compiled to display images in an xterm.
> 
> Very well.  But how do we convert a multipart/related message with
> text/html and image/foo parts into something that w3m can digest?
> 
> I believe that some messages have text/html parts that reference real
> files or URLs: <img src="foo.jpg">
> 
> But in other cases, it reference the content id: <img src="cid:deadbeef">

Mutt doesn't know anything about HTML.  Most browsers don't know 
anything about cid references.  So I think a solution could look 
like this.

Bind a key to pipe a message into a script.  The script would do the 
following.

1.  Create a temporary directory and cd there.
2.  Use munpack to unpack the message into its component MIME parts 
    and save each part as a file.
3.  Edit (using sed or perl, for example) the HTML text part of the 
    message to change all cid references to file URLs pointing to 
    the files in the current directory.
4.  Run a graphical browser on this modified HTML file.
5.  Remove the temporary directory and its contents.  (When?)

It looks like there are some Perl and Python modules that could help 
with this and would eliminate the need for munpack, but I haven't 
investigated them.

I've done a little Googling on this topic and I've installed and 
played with munpack a little, but that's as far as I've gotten with 
this.

Regards,
Gary