#!/bin/sh

THUNDERBIRD_REMOTE="/opt/thunderbird/mozilla-xremote-client"
THUNDERBIRD=`which thunderbird`

URL="$1"
MAILTO=`echo $URL | sed -s 's/mailto:\(.*\)/\1/'`
echo "URL=$URL MAIL=$MAILTO"
#exit 1

if [ -x ${THUNDERBIRD_REMOTE} ]; then
    ${THUNDERBIRD_REMOTE} -a thunderbird "mailto($MAILTO)"
elif [ -x ${THUNDERBIRD} ]; then
	${THUNDERBIRD} -P default -compose "$MAILTO"
else
    echo "Unable to find mozilla-xremote-client or thunderbird"
fi
exit 0

