gmail.js icon indicating copy to clipboard operation
gmail.js copied to clipboard

Getting Gmail API Compatible Message ID when email has been sent

Open anilreddyr7 opened this issue 5 years ago • 4 comments

Currently when email is sent, I'm able to get sent item data but message id is not compatible with Gmail Official Messages API. I'm doing it in below manner. gmail.observe.after("send_message",function(url, body, data, response) { emailId = data.messageId; }) Email ID is like msg-a:r-*********** But it is not supported with Official Gmail API.

Can anyone help me with this how can we get proper message id?

anilreddyr7 avatar Sep 24 '19 16:09 anilreddyr7

@josteink Can you let me know if you have some idea

anilreddyr7 avatar Sep 25 '19 15:09 anilreddyr7

You can get the smtp email-ID using the new gmailjs data-API.

Not sure if that can be used with the regular Gmail Oauth API, as I haven’t used that myself.

josteink avatar Oct 03 '19 17:10 josteink

@josteink do you mean message Id which is available smtp headers? can you let me know which code can be used to get that? When we intercept the sent item request, I don't see any id like you said but it can be helpful if you give me which code can be used to that.

anilreddyr7 avatar Oct 03 '19 20:10 anilreddyr7

do you mean message Id which is available smtp headers

Yes.

You don't get it in the sent event, which is triggered before Gmail actually sends it to the recipient. This is weird issue caused by Gmail's "undo send" feature.

However if you obtain the "regular" mail-id in the sent-event, you can then later use `api.new.get.email_data(mailId) to obtain info about the sent email, and that structure should then contain the smtp-id.

josteink avatar Oct 04 '19 12:10 josteink

Old issue is old. Closing.

josteink avatar Oct 11 '23 08:10 josteink