I was briefly inspired by the O'Reily book 'Practical Internet
Groupware' and a mail oriented project I'm working on, to write this
script. It handles rfc 2368 mailto: links in urlview and passes them on
to the mutt command line.

This sort of stuff:

    <mailto:[EMAIL PROTECTED]?subject=What%20a%20dumb%20RFC>
or 
    <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]&subject=Hi%20There!>

Gets rewritten (most of the time) to:

    mutt  '[EMAIL PROTECTED]' -s 'What a dumb RFC'
and
    mutt  '[EMAIL PROTECTED]' -s 'Hi There!'

There's a fairly remote possibility that someone else might find this
useful and want to add it to their web of mutt helpers, so I'm posting 
it here.. 

It doesn't do extra headers like 'In-Reply-To:' or body text. This
wouldn't have been too hard to add.

Change the line in url_handler.sh that calls mutt:

    mutt `echo $url | sed 's;^[^:]*:\(.*\);\1;'`
to
    mutt-rfc2368 $url

Bruno
-- 
mailto:[EMAIL PROTECTED]
http://bruno.postle.net
#!/bin/sh
# Rewrites RFC2368-style URI's to mutt command-line format
# [EMAIL PROTECTED] 20-feb-2000

URI=`echo $1 | tr '%20' ' '`

TO=`echo $URI | egrep '^<?mailto:[^@\?&]+@[^@]+' | sed 's;^[^:]*:\([^\?]*\).*;\1;'`

CC=`echo $URI | egrep '[\?&]cc=[^@\?&]+@[^@]+' | sed 's;^.*[\?&]cc=\([^&>]*\).*$;\1;'`

SUBJECT=`echo $URI | egrep '[\?&]subject=[^&]' | sed 
's;^.*[\?&]subject=\([^&>]*\).*$;\1;'`

ARGS=""

if [ -n "$TO" ] ; then
       ARGS="$ARGS '$TO'"
fi

if [ -n "$CC" ] ; then
       ARGS="$ARGS -c '$CC'"
fi

if [ -n "$SUBJECT" ] ; then
       ARGS="$ARGS -s '$SUBJECT'"
fi

eval "mutt $ARGS"

PGP signature

Reply via email to