Dragons in the Algorithm
Adventures in Programming
by Michael Chermside

Mailto for Gmail

My employer now uses gmail for our company email (and it's what I use at home also) so I would like "mailto:" links to work with Gmail. Unfortunately, all the normal processes for making Chrome use Gmail for such links failed for me. I went digging and found a solution that worked for me.

Before using this, try more straightforward solutions. Go to a page that has a mailto link on it (or just use this) and try clicking on it. See if your browser will cooperate with setting up the access.

Did that fail? If so, then let's bring on the complex solution:

  1. Navigate to gmail
  2. Access a javascript command line. (For the version of Chrome I have now, that's Menu > More Tools > Developer Tools.)
  3. From the URL bar, read the path to gmail. For me that is "https://mail.google.com/mail/u/1/" as I have both a personal and a corporate gmail account.
  4. Execute the following code
    navigator.registerProtocolHandler("mailto", "<gmail-path>?extsrc=mailto&url;=%s","Gmail"); (replacing "<gmail-path>" with the path you got above).
  5. Click "Yes" in the approval popup.

If this worked properly then you should be able to see the results by navigating to chrome://settings/handlers.

For what it's worth, I never had any difficulty configuring Firefox to handle mailto links the way I wanted.

Posted Mon 07 January 2019 by mcherm in Technology