* Chip Camden on Saturday, September 04, 2010 at 15:22:57 -0700
> Quoth Christian Ebert on Saturday, 04 September 2010:
>> * Charles Jie on Saturday, September 04, 2010 at 18:40:43 +0800
>>> I've been using mutt for 7 years. From time to time, such idea may flash
>>> in my brain.
>>> 
>>>   I can read most of my daily mail with mutt without problem.
>>> 
>>>   But sometimes some friends may send me an html mail with pretty rich
>>>   inline images. Such embedded images need to be seen in right
>>>   context (there are related text arround them).
>>> 
>>>   My current practice is bouncing the mail to another user in my linux
>>>   box, and launch Thunderbird to get and read it.
>>> 
>>> I'm wondering if it is possible for my mutt to copy the message to a
>>> temporary mbox file, and launch a GUI mail viewer to view it. (the way a
>>> little like what we do about attachment)
>>> 
>>>   I've checked Thunderbird's command line usage. It accepts a URL
>>>   (thunderbird -mail URL) but it doesn't treat it as mbox (but raw
>>>   text).
>>> 
>>>   Any idea or experience?
>> 
>> Shameless plug:
>> 
>> If you're not afraid of Python, you could try viewhtmlmsg of my
>> muttils bundle. It seems to do what you want.
>> 
>> $ viewhtmlmsg -h
>> Usage: viewhtmlmsg [options]
>> 
>> Displays html message read from stdin.  $BROWSER environment may be 
>> overridden
>> with option "-b".
>> 
>> Options:
>>  --version             show program's version number and exit
>>  -h, --help            show this help message and exit
>>  -s, --safe            view html w/o loading remote files
>>  -k KEEP, --keep=KEEP  remove temporary files after KEEP seconds (0 for
>>                        keeping files)
>>  -b APP, --browser=APP
>>                        prefer browser APP over $BROWSER environment
>> 
>> But it is mainly meant to be used from within Mutt via a macro:
>> 
>> # call viewhtmlmsg from macro
>> macro index,pager <F7> "\
>> <enter-command> set my_wait_key=\$wait_key wait_key=no<enter>\
>> <pipe-message>viewhtmlmsg<enter>\
>> <enter-command> set wait_key=\$my_wait_key &my_wait_key<enter>\
>> " "view HTML in browser"
>> 
>> macro index,pager <F8> "\
>> <enter-command> set my_wait_key=\$wait_key wait_key=no<enter>\
>> <pipe-message>viewhtmlmsg -s<enter>\
>> <enter-command> set wait_key=\$my_wait_key &my_wait_key<enter>\
>> " "view HTML (safe) in browser"
> 
> That's pretty cool.  It looks though like it doesn't accept a shell
> wrapper for the browser:
> 
> viewhtmlmsg -b browser
> 
> where browser is a shell script as follows:
> 
> #!/bin/sh
> if RunningX
> then
>   firefox $*
>   xdotool key super+3
>   xdotool keyup super
> else
>   w3m -t text/html $*
> fi
> 
> It appears from debugging that we never even get into this script, yet no
> error is generated.  Same result if I put the full path on the script.
> 
> Works great with just 'viewhtmlmsg -b firefox' though, and the odd thing
> is that 'firefox' is a shell script in /usr/local/bin.

That's because the script uses Python's webbrowser module

http://docs.python.org/library/webbrowser.html

for browser detection and handling.

I deemed it sufficient for most use cases.

c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org/
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions

Reply via email to