Shortly: How to open email in gmail if I know its id in new window?
Greetings. I get from GMAIL API the id of needed email. I want it to open in separate window by, for example, btn click in my add-on. What I know:
window.location.href =
to open url in new window.https://mail.google.com/mail/u/0/#drafts?compose=NeededID
but it wont work with for example Sent
emailsAny idea how the url should look like so that you can open the email in separate window in gmail.
Total recall. Solution was found. The solution can be applied to open email in any folder not only in Sent folder.
To Open email in new window need its id
and thread_id
of that email.
Also known as messageId
and conversationId
.
By example messageId looks like this- msg-a:r8357142279172082424
and thread id looks like this - thread-a:r-7561979775658404696
So here is javascript code with URL to open existing email in new window.
const message = encodeURIComponent(`#${conversationId}|${messageId}`);
const url = `https://mail.google.com/mail/u/0/#all/${message}`;
const windowHeight = '540';
const windowWidth = '960';
window.open(url, '_blank', `location=yes,height=${windowHeight},width=${windowWidth},scrollbars=yes,status=yes`);
the result is this