[notmuch] viewing text/html (inline or otherwise)

Keith Packard keithp at keithp.com
Tue Feb 9 22:10:02 PST 2010


On Tue, 09 Feb 2010 16:22:56 -0800, Carl Worth <cworth at cworth.org> wrote:

> I know that Keith is using a little script he wrote so that he can hit
> '|' on a message and pipe it to his script. The script then uses a
> utility, (munpack?) to extract all the various MIME parts to a temporary
> directory and then run a web broswer on that directory. Perhaps Keith
> would be so kind as to share that script with the community here.

It's not much of a script, I call it 'view-html'

#!/bin/sh
dir=`mktemp -d`
trap "rm -r $dir" 0
cat "$@" > "$dir"/msg
if munpack -C "$dir" -t < "$dir"/msg 2>&1 | grep 'Did not find'; then
    sed -n '/[Hh][Tt][Mm][Ll]/,$p' "$dir"/msg > $dir/part1.html
    rm "$dir"/msg
fi
for i in "$dir"/part*; do
    if grep -q -i -e '<html>' -e 'text/html' "$i"; then
	iceweasel "$i" &
	sleep 3
	exit 0
    fi
done

Note that if iceweasel isn't already running, it seems to shut down when
the script exits. I don't know why.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100209/24edf42b/attachment.pgp>


More information about the notmuch mailing list