I want to provide links to specific GMail folders, GMail messages, Google Drive items etc on a company webpage.

Users may have multiple Google accounts and it is not guaranteed that their primary / default account is the company account.

You'd expect this to be trivial and well documented, but ... not so much. Google multi-account support uses URLs with /u/2 (or similar) to differentiate users by login ordinal position in the current session. These links break if the user logs out of an account then back in and they cannot be shared correctly between users.

Google accounts have the seemingly undocumented feature of supporting /u?authuser=me@domain.com links which work but require a fully qualified user account. I could not find any documentation on it, nor any listing of supported paramters, and my guesses did not turn up any obvious "authdomain" type links that'd pick the currently logged in user matching the domain-part.

The redirect mechanism used by Google for subdomains does not appear to work for gmail links. You can't take a link to https://mail.google.com/mail/u/1/#search/rfc822msgid%xxxxx%40mydomain.com and massage it into https://mail.mydomain.com/mail/u/#search/rfc822msgid%xxxxx%40mydomain.com or variants I tried with /u? etc. You'll get an error like

Secure Connection Failed

An error occurred during a connection to mail.mydomain.com. PR_END_OF_FILE_ERROR


This site can’t be reached

mail.mydomain.com unexpectedly closed the connection.


So all in all, it's ghastly. Not to mention that GMail searches to specific messages or threads are already painful; you have to "view source" because you can't customise the headers shown, then hand-concoct a rfc822msgid:THE_MSGID_HERE msgid search.

Am I missing some simple sane way to just send a link that'll take the recipient to a specific label, mailbox, message ID, search, etc?


The two best options I've concocted so far, given a link to a msgid search with original URL



Use a http-only redirect link and remove the user-id-enumerator

        ^^^^^^^^^^^^^^^     ^^^^^
        mail.mydomain.com   delete


Redirect via the Google account-chooser

Strip the user qualifier from the URL, and use the Google Account selector redirector for Google Apps at https://admin.google.com/ (but this may only work for admin accounts?)


then url-escape and prefix:


Frankly this seems utterly ridiculous. Is there some sane sensible way to do this that doesn't require mangling URLs in undocumented might-break-tomorrow-if-Google-feels-like-it ways?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.