Personal tools
You are here: Home Blog Google Mail as default mail client

Google Mail as default mail client

Posted by lukepomfrey at Oct 07, 2009 12:20 AM |

How to use Google Mail's web interface as your default mail client

This is mainly for my dad who hasn't worked out how to stop Evolution from starting every time he clicks a mailto: link and uses Google mail. So here's how to use Google Mail's web interface as your default mail client.

First of all create a empty text file called gmail_compose in your home folder (or wherever), make it executable, and then copy and paste the following into it…

#!/usr/bin/env bash
uri=$( echo "$1" | sed -e "s/subject=/su=/" -e "s/^mailto:\([^&?]\+\)[?&]\?\(.*\)$/\1\&\2/" )

firefox "https://mail.google.com/mail?view=cm&tf=0&to=${uri}"

Of course you can substitute Firefox for whatever browser you use. Or, if multiple users have access to the script, try xdg-open.

Then set this script as your default mail client for whatever desktop you're using. For example in Gnome go to System > Preferences > Preferred Applications, and then in the "Mail Reader" section select Custom from the drop down box and in the "Command" box put /location/to/gmail_compose %s, e.g. /home/<username>/gmail_compose %s.

Document Actions
  • Send this
  • Print this
  • Share this
Add comment

You can add a comment by filling out the form below. Plain text formatting.

Info
Note: you are not logged in. You may optionally enter your username and password below. If you don't enter your username and password below, this comment will be posted as the 'Anonymous User'.
(Required)
(Required)