Adverts
As good as Firefox and Thunderbird are they just don't play nicely together under Linux. It doesn't seem like much to ask to be able to open mailto links in Thunderbird but it requires you to get under the hood and do some hacking to make it work. The guide below will allow you to click on any mailto link in Firefox and have it open a new mail in Thunderbird whether it is running or not. This guide works with Thunderbird 0.8 and Firefox 1.0, the most current versions in Debian testing, and should work with all up and coming releases as well since the API is unlikely to change much.
The Script
Place this script in the root of your home directory, call it ".firefox-mailto-fix.sh", and give yourself execute permissions (chmod 744 ~/.firefox-mailto-fix.sh).
#!/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
If you need to, change the locations of thunderbird and the xremote script. These are the standard locations if you apt-get install Thunderbird on Debian.
Modifications for Distributions Other Than Debian
I can't confirm that any of these work as I only run Debian testing but they have been submitted by readers and look about right. Generally they are just changes in the location of the scripts that this script calls and sometimes and extra parameter indicating which program to start. The extra parameter is required if you use the slightly older mozilla-xremote-client rather than the separate scripts with ship with the 1.0 versions of Thunderbird and Firefox.
Red Hat 9
Replace
THUNDERBIRD_REMOTE="/usr/lib/mozilla-thunderbird/mozilla-thunderbird-xremote-client"
with
THUNDERBIRD_REMOTE="/usr/lib/thunderbird-0.9/mozilla-xremote-client -a thunderbird"
SuSE 9.1
This version of the script was submitted by a reader of this site. Many thanks for the contribution. He was using:
suse linux 9.1
firefox 1.0.7
thunderbird 0.5
#!/bin/ksh
exec > /home/username/maillauncher.log 2>&1
# thunderbird launcher from firefox
echo "Arguments:"
for i
do
echo "'$i'"
done
set -x
THUNDERBIRD="/usr/bin/thunderbird"
THUNDERBIRD_REMOTE="$THUNDERBIRD -remote"
#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
Note that it logs the result of running the script to a file in your home directory so you need to change username in the second line to your account name.
Tweek Firefox
I am not sure what Firefox does by default with mailto links. At first they just didn't work but when I installed Evolution to give that a bash Firefox started opening that as the default mail client. I have read that you can have some luck setting the default mail client in Gnome but as I use KDE that isn't much use to me. If you are wondering, I have Gnome installed as well which is probably how come Evolution used to start.
Start up Firefox and open the url "about:config" which presents you with a page that, if you know much about Windows, is similar to the Windows registry. Right ckick and sdd a new key called "network.protocol-handler.app.mailto" with the value "/home/[user]/.firefox-mailto-fix.sh" (where you have replaced [user] with your username).
You should find that mailto links now work.
Updates
A kind reader pointed out that as the script is written in bash it is possible to use a bash built in function rather than sed to remove the mailto at the start of the address. Simply replace:
MAIL_DATA=`echo "$MAILTO_URL" | /bin/sed -s 's/^mailto://'`
with
MAIL_DATA=\${MAIL_URL#mailto:*}
Alternatives
A reader drew my attention to this page that details an alternative method to get Firefox and Thunderbird playing together nicely. There are also instructions for modifying the user.js file. Note, I haven't tried either of these as I have since switched over to using KMail through Kontact which I find to be a far better mail client and all round solution.