同一电子邮件的电子邮件ID更改?(Email ID for the same email changes?)

编程入门 行业动态 更新时间:2024-10-18 14:13:58
同一电子邮件的电子邮件ID更改?(Email ID for the same email changes?)

我最近遇到一个问题,即电子邮件的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. ^^

更多推荐

本文发布于:2023-08-03 20:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1398172.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电子邮件   ID   email   Email

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!