gmail.js
gmail.js copied to clipboard
Getting Gmail API Compatible Message ID when email has been sent
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?
@josteink Can you let me know if you have some idea
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 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.
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.
Old issue is old. Closing.