Search code examples
pythongmailpop3poplib

Select mails from inbox alone via poplib


I need to download emails from the gmail inbox only using poplib.Unfortunately I do not see any option to select Inbox alone, and poplib gives me emails from sent items too.

How do I select emails only from inbox?

I dont want to use any gmail specific libraries.


Solution

  • POP3 has no concept of 'folders'. If gmail is showing you both 'sent' as well as 'received' mail, then you really don't have any option but to receive all that email.

    Perhaps you would be better off using IMAP4 instead of POP3. Python has libraries that will work with gmail's IMAP4 server.