I am trying to extract mails from gmail using python. I noticed that I can get mails from "[Gmail]/All Mail", "[Gmail]/Drafts","[Gmail]/Spam" and so on. However, is there any method to retrieve mails that are labeled with "Primary", "Social", "Promotions" etc.? These tags are under the "categories" label, and I don't know how to access it.
By the way, I am using imaplib in python. Do I need to access the "categories" with some pop library?
Yes, categories are not available in IMAP. However, rather than filters, I found that gmail api is more favorable for me to get mail by category.
How to extract mail in "categories" label in gmail?