Reputation: 107
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
Upvotes: 2
Views: 3309
Reputation: 4703
You can do it using any of the 2 following ways.
You can use Message-Id
field of the mail header.Message-Id
field for both the mail
will be same.
Apply SEARCH
command on All Mail
Folder.
i.e search on title --> it will give you uid
for that mail.
Upvotes: 1
Reputation: 412
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.
Upvotes: 0