New: As of June 2017, the imapfetch program itself has not changed, but the companion program used to view imapfetch mail files has—PyMailGUI's display now looks like this and this on Mac OS X, and similar elsewhere. See PyMailGUI's home page for more details; some of the screenshots below are from its prior release, but work the same.
This short Python 3.X program fetches all messages from all (or selected) mail folders at an email account host, using the IMAP interface. POP provides access to the inbox only; IMAP is more complex and not universally supported, but also gives access to all other saved-mail folders at the host (e.g., sent mails, drafts, etc.).
Mails fetched from the server are saved in one local file per folder, but not removed from the server. The saved-mail files created by this script on your computer are designed to be viewed and processed offline with the PyMailGUI program, also available on this page. See the main script's docstring and other items below for usage details.
Code and docs:
This program was last changed December 4, 2015.
For more code examples, see the programs page.