Use Gmail as a desktop-wide mail client

With a little scripting, Gnome can be configured to use gmail as the default handler for mailto: URLs.

  1. First, open your favorite text editor and enter the following script code:
    #!/bin/sh
    gmailargs=`echo $1 | sed 's/mailto:/to=/' | sed 's/\?subject=/\&su=/' | \
        sed 's/\?cc=/\&cc=/' | sed 's/\?bcc=/\&bcc=/' | sed 's/\?body=/\&body=/'`
    firefox -remote "openurl(https://mail.google.com/mail?view=cm&$gmailargs, new-tab )"
    
  2. Then, save this file to you home directory and give it a .sh extension, for example ~/.open_mailto.sh
  3. Finally, set the default mail reader for the system by going to System > Prefrences > Preferred Applications. Under Mail Reader choose Custom, then in the Command field, type the path to your script, adding a %s argument. For example, with suggested filename, the command should look like ~/.open_mailto.sh %s

Thanks to ian for sending this in.

Comments