Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Are you a GMail user who's tired of not being able to use email (mailto:) links? Here's a way to make them work again! As an added bonus, mail-client/mail-notification (and possibly others) will correctly open GMail when told to open a mail client.


The script

This article shows how to set up a gmail mailto: script that all users can use. To create a script just for yourself, simply use ~/.gmail-mailto instead of /usr/bin/gmail-mailto.

# nano -w /usr/bin/gmail-mailto
File: /usr/bin/gmail-mailto

#when we are passed an email address like this:

#we want to generate a uri like this:

#Unless you are using gmail for a hosted domain, then you want to use this:

#NOTE from and the editor of the above line: the /a/ may differ from domain to domain, I'm not sure I only have one hosted domain.

# remove the ? from the uri
uri=`echo "$1" | sed -e 's/subject=/su=/' -e 's/^mailto:\([^&?]\+\)[?&]\?\(.*\)$/\1\&\2/'`

if [ "$uri" ];
 then exec $BROWSER "$uri"

exec $BROWSER ""

(Adapted from [1])

# chmod a+x /usr/bin/gmail-mailto

This script loads GMail in Mozilla Firefox. To use a different browser, simply change firefox to the desired browser at the start of the script, e.g.:


Using the script


Open System -> Preferences -> Preferred Applications. Under Mail Reader, select Custom and enter:

gmail-mailto %s


Open Settings -> KDE Components -> Component Chooser. Under Email Client, select Use a different email client and enter:

gmail-mailto %t

You may also wish to set the browser to konqueror at the start of the script, if you haven't already.


Open the Settings panel (xfce-setting-show, I can't find it in the GUI) and click on Preferred Applications. Under Mail Reader, select Other, and enter:


Note: If you're using Firefox and have Gnome installed, you may need to open Gnome and follow that set of instructions. Firefox seems to look for Gnome's settings before XFCE's.


Try this:


Firefox still won't open GMail

This can be caused by a configuration setting in Firefox. According to [2], this can be fixed by going to the special "web page" about:config, finding and setting it to the correct program, in this case /usr/bin/gmail-mailto .

Retrieved from ""

Last modified: Sat, 11 Oct 2008 06:59:00 +0000 Hits: 8,081