How can I reliably link to a Gmail conversation gi

2019-01-24 18:31发布

问题:

If you're logged into multiple Gmail accounts, Google changes the URLs to reference which account you're currently using. For example:

https://mail.google.com/mail/u/0/#inbox/138d85da096d2126 for a convo in my primary account vs https://mail.google.com/mail/u/1/#inbox/128cfe99d055805d for a convo in another one of my accounts.

Note that one account has /u/0 in the URL and the other has u/1.

My question is: given that I've used the Gmail REST API to find the ID of a particular thread, how can I reliably link to that thread? Is there any programmatic way to ask Google which accounts the user is logged into, and what sequence (0, 1, 2, ...) each account falls under?

回答1:

Looks like you can include a query parameter called authUser that specifies the email account you want to link to:

https://mail.google.com/mail/?authuser=your.email.address@gmail.com#all/138d85da096d2126