Using multiple Gmail accounts with mailto: links in Firefox

By , 2012-08-19 20:36

For a while now, Google has allowed you to sign in to multiple Google accounts and switch back and forth between them quite easily. Firefox also allows you to use Gmail as the default application for mailto: links.

This is all fine and dandy, until you click a mailto: link and decide you don’t want to send that e-mail using your primary Gmail account. In my case, this happens when replying to posts on craigslist. I always assumed there wasn’t a “clean” solution, resigning myself to copying and pasting the e-mail and subject lines, or even at times clicking the mailto: link on my Android phone, which allows me to select any account on my phone to send the e-mail from.

Finally decided to do some research and found a solution on the mozillazine forums.

To summarize:

  1. Go to about:config in Firefox
  2. Set gecko.handlerService.allowRegisterFromDifferentHost = true
  3. Open the Web Developer scratchpad. (Firefox> Web Developer> Scratchpad or Tools>Web Developer > Scratchpad)
  4. In the scratchpad, type the following line of JavaScript:
navigator.registerProtocolHandler("mailto",
  "https://mail.google.com/mail/b/[email protected]/?extsrc=mailto&url=%s",
  "Description of your Gmail Account");
  1. Repeat the line as many times as necessary, once for each of your Gmail accounts.
  2. Once you have created all the necessary lines, go to Execute > Run.
  3. The “information bar” will pop up in your main Firefox window, asking you if you want to add your Gmail account as a handler for mailto: links. Accept once for each account.
  4. That’s it. Now when you click a mailto: link, you’ll be prompted which Gmail account to use.

7 Responses to “Using multiple Gmail accounts with mailto: links in Firefox”

  1. Firefox 23.0 Firefox 23.0 Mac OS X  10.8 Mac OS X 10.8
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0

    Wonderful! After many years of battling with this finally got a good workign solution!

  2. Firefox 23.0 Firefox 23.0 Mac OS X  10.8 Mac OS X 10.8
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:23.0) Gecko/20100101 Firefox/23.0

    Though looks like there is slight issue… the email address itself doesn’t come through (shows blank on me).

    • Michael Zenner says:
      Firefox 40.0 Firefox 40.0 Ubuntu x64 Ubuntu x64
      Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0

      Did you ever get this sorted? I’m now having the same problem.

      Great and helpful post, BTW!!!

  3. Adam says:
    Firefox 27.0 Firefox 27.0 Windows 7 x64 Edition Windows 7 x64 Edition
    Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0

    How do you edit this once it is created? I made this but I want to modify some of it but I can’t find a way to get back to it.

    Thanks!

    • Firefox 27.0 Firefox 27.0 Mac OS X  10.9 Mac OS X 10.9
      Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0

      You just re-register the protocol with new URL.

    • jenny says:
      Firefox 30.0 Firefox 30.0 Windows 7 x64 Edition Windows 7 x64 Edition
      Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0

      Go to Tools > Options > Applications tab > Content Type “mailto”
      Then select Application Details from drop-down menu. This is for Firefox 30, at least.

  4. Brian Minton says:
    Firefox 45.0 Firefox 45.0 GNU/Linux x64 GNU/Linux x64
    Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

    I tried this, but it didn’t work. I have an email address that’s not a gmail address (but it forwards to my gmail), that I use as the login for gmail. I also have gsuite for work. When I tried to use the my personal gmail account after clicking on a mailto: link, it still showed that it was loading my work email.

Leave a Reply

 

Custom theme by me. Based on Panorama by Themocracy