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

Re: Can one have two alternative programs to view text/html?



* Chris Green <chris@xxxxxxxxxxx> [2004-01-28 11:35 +0000]:
> 
> Is it possible to set up mutt and mailcap so that by default it uses
> lynx (or other text mode browser) to view HTML mail but one can use
> a GUI browser (is that the word) as an option?

Yes, it is possible, and yes, such a programme is called a browser.

> Normally I simply want to see the text of HTML E-Mail (that's all
> there is in most of them!) but occasionally they have pictures that I
> want to see.

To view text/html in mutt, you want to have an entry such as

 text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html

in your .mailcap; and in your .muttrc, put

 auto_view text/html


To use an external browser, I have the following macros and script:

 macro index <F11> "<copy-message>/tmp/tmpbox\n<enter><enter-command>unset 
wait_key\n<shell-escape>~/bin/mutt-view-html\n<enter-command>set wait_key\n"
 macro pager <F11> "<copy-message>/tmp/tmpbox\n<enter><enter-command>unset 
wait_key\n<shell-escape>~/bin/mutt-view-html\n<enter-command>set wait_key\n"

mutt-view-html:
#!/bin/sh

cd /tmp
mkdir mutthtmltempdir
cd mutthtmltempdir
munpack -q -t ../tmpbox

# Gizmo newsletter includes images, but references the ones on the website :(
grep ^To:.*@gizmo\.com\.au ../tmpbox > /dev/null

if [ $? == 0 ]
then
        sed -e 's#"http://www.gizmo.com.au/pics/#"#' -e 's#"newsletter/#"#' 
part2 > part2.html
        file=part2
else
# find the text/html part
        for file in part*
        do
                if [ "`file -b $file`" == "HTML document text" ]
                then
                        mv $file $file.html
                        break
                fi
        done
fi

galeon -n $file.html &
sleep 10
cd ..
rm -rf mutthtmltempdir tmpbox


HTH
-- 
Joshua 'bruce' Crawford ... http://www.geocities.com/mortarn

Counting in binary is just like counting in decimal if you are all thumbs.

Attachment: pgp69LSo8R0d6.pgp
Description: PGP signature