I am working on an email client and have run into a small problem. I am unsure of how to download the email messages and save them to the local HDD. I am able to connect to the server using IMAP4 SSL (with the code below).
import imaplib
server = imaplib.IMAP4_SSL('imap.gmail.com')
server.login('USER', 'PASS')
You can list directories in your mailbox with
IMAP4.list. To actually get messages out of a directory useIMAP4.select, and then useIMAP4.search, and iterate over the list of id’s it returns. In your case you could do something like this:Read the docs for sure: http://docs.python.org/library/imaplib.html. Also agree with this answer, read through PyMOTW’s tutorial. In general it’s a good place to check for tutorials for modules in the standard library.