Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

Using Gmail for mailto: links


Blame it on Seb, but I’ve been using Gmail’s web interface lately. This is partly because I’m in the middle of another life-changing job transition (but this one I’m really excited about, aside from the great white sharks and the triangle of death), partly because I like change (and after having used nothing but kmail for a few years now, I’m ready for a change if for nothing other than to see how we in KDE PIM land can do things better), and partly because I’m trying to keep less personal data on my work laptop. I have been using Google’s Apps For Your Domain for the last year or so, and I like it much good. However, one thing that Gmail lacks is any IMAP interface whatsoever, which means that I’ve had a really convoluted setup going on which uses GAFYD for my MX handling, and then involves a subdomain on my regular web host server which I forward all e-mail to and subsequently access via IMAP. Ick.

(Google people: PLEASE, PLEASE, PLEASE add an IMAP interface to Gmail!!! The workarounds suck!)

Anyway, I digress…

The second thing that irks me about Gmail’s web interface is that it has no API for syncing contact information whatsoever. This absolutely sucks, but I expect that with Google trying to position itself as an online “all your information are belong to us” provider, that they’ll either remedy the ridiculously bad contact handling themselves or replace it with an acquisition. Please? And let me sync it with my Palm PDA??

But back to the point, one thing that is lacking in using Gmail’s web interface is the ability to click on a “mailto” link (or right-click in Firefox and do “send link”). Apparently, there are Google-provided solutions to this on OS X and Windows (Google people: please treat the Linux desktop as a first-class citizen too??) but they’ve not done anything for this functionality on Linux. However, I came across this nice little HOWTO from the Gentoo folks, which does the trick quite nicely. I’ve modified the shell script slightly to try to stop Gmail from going into some kind of a loop and not actually working if there’s no recipient passed to it (like what happens when you RMB click in Firefox and do “send link”), but I’m not sure if it’s something goofy with GAFYD…:


ME=$(basename $0)

echo “$(date)| incoming uri: [$1]” >> ${DEBUG}

# remove the ? and mailto from the uri and convert “subject” to “su”
uri=$(echo “$1” | sed -e ‘s,subject=,su=,’ \
-e ‘s,\?,\&,g’ \
-e ‘s,^mailto:,,’)

echo “$(date)| outgoing uri: [$uri]” >> ${DEBUG}

if [ “$uri” ];
then exec $BROWSER “https://mail.google.com/mail?view=cm&tf=0&to=$uri”

exec $BROWSER “https://mail.google.com/”

[[ UPDATE ]] A zillion thanks to Giuseppe D’Angelo, who pointed me to the Better Gmail firefox extension.  This rocks a LOT!  =:)  So the above shell script still has relevance for KDE/GNOME url handling, but isn’t as necessary for firefox mailto’s…  =:)

Author: Jason 'vanRijn' Kasper

My name is Jason 'vanRijn' Kasper. I am the ring leader of the amazing Kasper family. I am unashamedly a Christian Nerd. These are our stories....


  1. Pingback: moving parts of the kasper clan » Archive du blog » Thinkpad T61 and a Blond ‘fro

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.