Tuesday, October 14, 2008

Using Gmail as the default mail client in Ubuntu

I finally got annoyed with Evolution opening up every time I clicked a mailto link in Firefox. So I did a little Googling and came up with this:
  1. Create a script in your home directory. I put it in ~/scripts and called it mailto.sh.
  2. As of today, this script works with Firefox 3.0.3:
    #!/bin/sh
    firefox "https://mail.google.com/mail?view=cm&tf=0&ui=1&to=`echo $1 | sed 's/mailto://'`"
  3. Make the script executable:
    chmod u+x ~/scripts/mailto.sh 
    (or a+x if you want to allow all other users to run it)
  4. Go to System → Preferences → Preferred Applications.
  5. Set Mail Reader to Custom, and enter the path to the script.
Shell scripting is a beautiful thing, folks.

No comments: