开发者

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 fol开发者_开发知识库der 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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜