[英]How to get UID of mail in All Maill folder if I have UID of this mail in inbox using imaplib? (GMail)
How to get UID of mail in All Maill folder if I have UID of this mail in inbox using imaplib? 如果我使用imaplib在收件箱中有此邮件的UID,如何在All Maill文件夹中获取邮件的UID? 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
如您所知,谷歌在“所有邮件”和“收件箱”中的两个实例中存储邮件,我希望使用imaplib将其移动到“垃圾箱”文件夹中的邮件中
You can do it using any of the 2 following ways. 您可以使用以下两种方式中的任何一种来进行操作。
You can use Message-Id
field of the mail header. 您可以使用邮件标题的
Message-Id
字段。 Message-Id
field for both the mail will be same. Message-Id
字段将相同。
Apply SEARCH
command on All Mail
Folder. 在
All Mail
文件夹上应用SEARCH
命令。 ie search on title --> it will give you uid
for that mail. 即搜索标题->它将为您提供该邮件的
uid
。
It can be done by searching with X-GM-MSGID over ALLMail folder. 可以通过在ALLMail文件夹中使用X-GM-MSGID搜索来完成。
Message X-GM-MSGID is unique across all folders in Gmail. 邮件X-GM-MSGID在Gmail中的所有文件夹中都是唯一的。 So You just need to fetch X-GM-MSGID of email in INBOX along with UID.
因此,您只需要在INBOX中获取电子邮件的X-GM-MSGID以及UID。
Now You need to search with X-GM-MSGID on AllMail folder like this 现在,您需要像这样在AllMail文件夹上使用X-GM-MSGID搜索
UID SEARCH X-GM-MSGID 1278455344230334865 UID搜索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 您可以在这里找到更多详细信息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. 我认为imap lib不支持Gmail增强功能。 You may need to extend the imap library with the Gmail specific commands.
您可能需要使用特定于Gmail的命令来扩展imap库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.