4

When I use the old Gmail I use this method:

https://mail.google.com/mail/u/0/#inbox/1630209116a3af45 and thread ID is: 1630209116a3af45.

In the new Gmail, the same thread link is:

https://mail.google.com/mail/u/0/?zx=3xcdey2cogvc#inbox/FMfcgxmZVPbZvwJWCvBMvjxglSMPvsvW

and there is no option to find it.

I also looked in the HTML source of the page and the thread ID is not there.

All of my searches show only the old Gmail behavior (like this: https://support.cloudhq.net/how-to-get-thread-id-of-a-gmail-thread/).

I want to find out how I can locate the thread id.

(I also tried to find it in the "show original" option, but I can find only the message id, and it does not help.)

0

3 Answers 3

4

You can get the thread id from the HTML. Try searching "data-legacy-thread-id" in the HTML elements.

Or you can find it by running JavaScript code in the console:

document.querySelector('[data-legacy-thread-id]').getAttribute('data-legacy-thread-id')
3

I've found that the answers above do not work every time because the DOM, in some cases, might have more messages and thus many data-legacy-thread-id, as can be seen below: image showing multiple matches for DOM search

By tweaking the CSS selector a bit you get the correct data-legacy-thread-id:

document.querySelector('[role="main"] [data-legacy-thread-id]').getAttribute('data-legacy-thread-id')

To make my life easier I created a bookmarklet using:

javascript:(function(){prompt("Legacy Thread ID",document.querySelector('[role="main"] [data-legacy-thread-id]').getAttribute('data-legacy-thread-id'))}());
1
  • 1
    Thanks, this was the missing step to get the right id. It'd be nice to have one combined answer. Jul 20, 2019 at 23:57
1

method 1:

  • press F12 while email is opened
  • go to Elements

method 2:

  • press F12 while email is opened
  • go to Console
  • paste: document.querySelector('[data-legacy-thread-id]').getAttribute('data-legacy-thread-id')
  • or paste: document.querySelector('[role="main"] [data-legacy-thread-id]').getAttribute('data-legacy-thread-id')
  • hit ENTER

2
  • 1
    Weird these answers were downvoted, especially without comments. It helped me realize I could search for the number in the DevTool Elements HTML view easy enough without needing to execute any JavaScript. The email I wanted was apparently on the first page in my Inbox, so that was easy enough.
    – Pysis
    Feb 5, 2019 at 15:58
  • This answer gets the first thread id on the page, which isn't always the thread id being displayed. See the other answer that addresses that and upvote. Jul 20, 2019 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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