Using a Gmail Message Source, Create a Direct Link

So, using the gmail message source, is it possible to create a link to the message / stream in the GMail native interface?

on http://productforums.google.com/forum/#!topic/gmail/goChl1gG0NQ they use the following

https://mail.google.com/mail/#all/<HexEncodeMessageID> 

Is this due to the Message = ID header found in the mail source?

 Message-ID: <SomeID@SomeID.mail> 

Discussion Finding Gmail URL identifiers through IMAP seems to only yield IMAP-based solutions.

+9
email-headers hyperlink gmail
source share
3 answers

Refresh

This bookmarklet no longer works. See Benjamin Zipert's update.

Original answer

I decided to make a bookmarklet to help automate this.

 javascript:window.location="https://gmail.com/#search/rfc822msgid:"+encodeURIComponent(window.document.body.innerHTML.match(/Message-ID: &lt;(.*)&gt;/i)[1])+"/"+encodeURIComponent(window.location.search.toString().slice(1).split('&').filter(function(x){return x.slice(0,3) == "th="})[0].slice(3)); 

Save this link in your bookmarks bar. To get a direct link to the message, select "Show original" in the drop-down list for that message, and then click the bookmarklet on the new page that opens.

If anyone has suggestions for a clean way to do this without clicking the "Show Original" button, I'm all in my ears.

+10
source share

The "HexEncodeMessageID" that you link to (and this happens in links such as https://mail.google.com/mail/#inbox/14197d2548c9da1a ), unfortunately, differs from the RFC822 message identifier (which happens in the message source).

I don’t know how to get a direct email link using RFC822 message id, but you can find the specific RFC822 message id in Gmail (see GMail doc ):

 in:anywhere rfc822msgid:SomeID@SomeID.mail 

You can turn this into a link:

https://mail.google.com/mail/#search/in%3Aanywhere+rfc822msgid%3ASomeID@SomeID.mail

(Remember that the message identifier must be URL-encoded . You can also just enter a search in your GMail and copy the resulting URL afterwards.)

The problem with this link is that it does not send you directly to the mail, but to the search results page with one hit. But this may be good enough for some applications.

Benefit: RFC822 is the same in your account and the sender's account. Therefore, if you want to refer to this letter in an email / chat, you can specify this link for the search (provided that the recipient also uses GMail). With "HexEncodeMessageID" this will not work, because in each account it is different from the others (according to my own experiments).

Last: the link only works when you are already logged in.

+7
source share

Here is the updated bookmarklet proposed by Benjamin Zipert. Mostly with the / u / 0 part removed to make it a bit more account independent.

 javascript:window.open("https://mail.google.com/mail/#search/rfc822msgid%3A" + encodeURIComponent(document.getElementsByClassName('message_id')[0].innerHTML.slice(4, -4)), "_self"); 

Usage: Save this link to your bookmarks bar. To get a direct link to the message, select "Show original" in the drop-down list for that message, and then click the bookmarklet on the new page that opens.

0
source share

All Articles