Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

Using Gmail for mailto: links

| 10 Comments

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…:

#!/bin/sh
BROWSER=”firefox”

ME=$(basename $0)
DEBUG=/tmp/$ME.debug

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”
fi

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....

10 Comments

  1. Why would you do this when you can use KMail to send mail via SMTP on GAFYD?

  2. Hey Jason,

    Actually, if you install the Google toolbar on firefox, it will make the mailto links go to Gmail. I installed the toolbar and then chose the option where it replaces the firefox search bar (cause I didn’t care for all of the buttons), just so I could get my links to go to Gmail.

    Good luck,

    Gustavo

  3. Heya Samir,

    Um. I’m not using KMail with my GAFYD mail currently because of the reasons I listed (no IMAP interface, trying not to keep personal data on work laptop, etc., etc.). And yes, when I was using my IMAP server which was populated via auto-forwarding everything from GAFYD, I did use GAFYD as my SMTP host. =:)

  4. Hi Gustavo,

    Does this work for the google firefox toolbar on Linux? Thanks!! =:)

  5. IIRC there’s an extension, “Better GMail”, providing what you’re looking for.

  6. Giuseppe,

    You ROCK!! This is perfect!! =:) Thanks very much for pointing me there!! =:)

  7. You’re welcome :))

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

  9. I’m sure you’ve seen it by now, but Google just released IMAP support for Gmail.

    Link

  10. Tim: Holy CRAP!! This is awesome!!! =:) And no, I’ve been without a laptop for so long that I did not know this. Thanks for the comment!!! =:)

Leave a Reply

Required fields are marked *.


 

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