On 2014-11-11, steve wrote:
>   Hi all,
> 
>   I'm receiving reports in html containing images. In mutt, those images
>   are separated from the html file. For example, when I press 'v', I see
>   the html file on one line and the image on another. Pressing 'enter'
>   fires up firefox to display the html file. Problem, the image will not
>   show in that page (it doesn't find the image's address).
> 
>   I've been looking around for a solution but failed until now, so
>   that's the reason I'm posting here.
> 
>   How could I achieve that?

I use viewhtmlmsg from the muttutils package,
https://bitbucket.org/blacktrash/muttils.  It opens the message,
including images, in a browser.

To make it more convenient to use, I have these macros in my
~/.vimrc which use the shell script shown below.

# View the message using viewhtmlmsg.
#
macro index,pager ,v "\
<enter-command> set my_pipe_decode=\$pipe_decode my_wait_key=\$wait_key \
pipe_decode=no wait_key=no<enter>\
<pipe-message> mutt_viewhtmlmsg -s<enter>\
<enter-command> set pipe_decode=\$my_pipe_decode wait_key=\$my_wait_key \
&my_pipe_decode &my_wait_key<enter>\
" "view HTML (safe) in browser"
macro index,pager ,V "\
<enter-command> set my_pipe_decode=\$pipe_decode my_wait_key=\$wait_key \
pipe_decode=no wait_key=no<enter>\
<pipe-message> mutt_viewhtmlmsg<enter>\
<enter-command> set pipe_decode=\$my_pipe_decode wait_key=\$my_wait_key \
&my_pipe_decode &my_wait_key<enter>\
" "view HTML (unsafe) in browser"

------------------------- mutt_viewhtmlmsg -------------------------
#!/bin/bash
tmpfile=$(tempfile) || exit 1
cat > "$tmpfile"
export BROWSER=midori
{
    viewhtmlmsg "$@" < "$tmpfile" >/dev/null 2>&1
    rm -f "$tmpfile"
} &
--------------------------------------------------------------------

Regards,
Gary

Reply via email to