Ohad Dahan
Ohad Dahan

Reputation: 351

Email ID for the same email changes?

I'm facing an issue lately that the id of an email changes.

I have an application that search the mail box on an hourly basis and I store the email id in order to prevent processing of the same email twice (the scans overlap hence I see the same emails more than once).

Any idea what can cause this change?

Upvotes: 0

Views: 186

Answers (1)

JamesR404
JamesR404

Reputation: 24

I understand you mean Google's ID which is returned by the API like with this example code; https://developers.google.com/gmail/api/v1/reference/users/messages/list#try-it

That ID of a message doesn't change by itself.

If one moves the email out of the account, and back in (via IMAP), then it would get a new ID.

Also, if you check the same email but in a different Gmail account, the ID will be different. the ID is unique only per account.

Perhaps it is useful for you to use the message-id? The message-id uniquely identifies any email, this ID is in the email header generated by the sending server and does not change. You can search for it in Gmail with rfc822msgid:

Hope this answers your question, but also let us know if not. ^^

Upvotes: 1

Related Questions