Reputation: 2789
I'm trying to retrieve new mails from sent mail folder of Gmail using IMAP, but in the sent folder every messages are has the \Seen flag set. So I cannot retrieve the latest messages in the folder.
imap_conn.select("[Gmail]/Sent Mail")
typ, data = imap_conn.search(None,since_date,'UnSeen')
Do anyone have idea for how to retrieve the new mails from sent folder?
Upvotes: 1
Views: 2867
Reputation: 476
For the name to use for your 'Sent Items' folders check:
mail.list()
Make sure you use the extra quotes in your string, e.g.:
imap_conn.select('"[Gmail]/Sent Mail"')
That worked for me.
Upvotes: 3
Reputation: 2828
Although less efficient then Gryphius' answer, you create a custom IMAP flag and then mark all the message you have seen with that custom flag.
Here is an example from SO: javamail: Setting custom flags on imap mail and searching for mails with custom flags
Upvotes: 0