我最近遇到一个问题,即电子邮件的ID发生了变化。
我有一个应用程序,每小时搜索邮箱,我存储电子邮件ID,以防止处理相同的电子邮件两次(扫描重叠,因此我不止一次看到相同的电子邮件)。
知道什么可以导致这种变化吗?
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?
最满意答案
我理解你的意思是API返回的ID,就像这个示例代码一样; https://developers.google.com/gmail/api/v1/reference/users/messages/list#try-it
消息的ID不会自行更改。
如果将电子邮件移出帐户并返回(通过IMAP),则会获得新ID。
此外,如果您检查同一封电子邮件但在其他Gmail帐户中,则ID会有所不同。 该ID仅适用于每个帐户。
也许你使用message-id是有用的? message-id唯一标识任何电子邮件,此ID位于发送服务器生成的电子邮件标头中,不会更改。 您可以使用rfc822msgid在Gmail中搜索它:
希望这能回答你的问题,但如果没有,也请告诉我们。 ^^
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. ^^
更多推荐
发布评论