#!/bin/bash
# This script allows FireFox to send mailto: links
# to Thunderbird
THUNDERBIRD="/usr/bin/mozilla-thunderbird"
THUNDERBIRD_REMOTE="/usr/lib/mozilla-thunderbird/mozilla-thunderbird-xremote-client"
#echo "Firefox mailto: $*" >> $HOME/log.txt
MAILTO_URL="$1"
#Strip off the protocol as this confuses Thunderbird
MAIL_DATA=`echo "$MAILTO_URL" | /bin/sed -s 's/^mailto://'`
if $THUNDERBIRD -remote 'ping()' ; then
$THUNDERBIRD -remote "mailto( $MAIL_DATA )"
else
#The mailto needs to be in the format mailto:someone@example.com
#eg not mailto://someone@example.com
$THUNDERBIRD -P default -compose "$MAILTO_URL"
fi
exit 0