如果我使用 imaplib 在收件箱中有此邮件的 UID,如何获取所有 Maill 文件夹中邮件的 UID? (Gmail)

发布于 2024-09-27 13:44:30 字数 118 浏览 0 评论 0原文

如果我使用 imaplib 在收件箱中有此邮件的 UID,如何获取所有 Maill 文件夹中邮件的 UID? 如您所知,谷歌将邮件存储在所有邮件和收件箱中的两个实例中,我想使用 imaplib 将其移动到垃圾文件夹中的邮件

How to get UID of mail in All Maill folder if I have UID of this mail in inbox using imaplib?
As you know the google store mails in the two instances in All Mail and in inbox I whant to move this to mail in trash folder using imaplib

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独木成林 2024-10-04 13:44:30

您可以使用以下 2 种方法中的任何一种来完成此操作。

  1. 您可以使用邮件标头的 Message-Id 字段。Message-Id 字段适用于邮件
    将会相同。

  2. 所有邮件文件夹应用SEARCH命令。
    即搜索标题 -->它会为您提供该邮件的uid

You can do it using any of the 2 following ways.

  1. You can use Message-Id field of the mail header.Message-Id field for both the mail
    will be same.

  2. Apply SEARCH command on All Mail Folder.
    i.e search on title --> it will give you uid for that mail.

十级心震 2024-10-04 13:44:30

可以通过使用 X-GM-MSGID 在 ALLMail 文件夹中搜索来完成。

邮件 X-GM-MSGID 在 Gmail 中的所有文件夹中都是唯一的。因此,您只需获取收件箱中电子邮件的 X-GM-MSGID 以及 UID 即可。

现在您需要在 AllMail 文件夹上使用 X-GM-MSGID 进行搜索,如下所示

UID SEARCH X-GM-MSGID 1278455344230334865

您可以在此处找到更多详细信息
https://developers.google.com/google-apps/gmail /imap_extensions#access_to_the_gmail_unique_message_id_x-gm-msgid

我认为 imap lib 不支持 Gmail 增强功能。
您可能需要使用 Gmail 特定命令来扩展 imap 库。

It can be done by searching with X-GM-MSGID over ALLMail folder.

Message X-GM-MSGID is unique across all folders in Gmail. So You just need to fetch X-GM-MSGID of email in INBOX along with UID.

Now You need to search with X-GM-MSGID on AllMail folder like this

UID SEARCH X-GM-MSGID 1278455344230334865

You can find more details here
https://developers.google.com/google-apps/gmail/imap_extensions#access_to_the_gmail_unique_message_id_x-gm-msgid

I don't think imap lib supports Gmail enhanched capabulities.
You may need to extend the imap library with the Gmail specific commands.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文