imapfetch — Fetch/Save IMAP Email Folders

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.

Overview

This short Python 3.X program fetches all messages from all (or selected) email 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, which also illustrates POP and SMTP email processing, and swaps IMAP folders for local saved-mail files.

Resources

See the main script's docstring and other items below for usage details.

Code and docs:

Examples:

Download

Use the following to fetch imapfetch, or view its unzipped content.

This program was last changed: December 2015.

For more code examples, see the programs page.



[Home] Books Programs Blog Python Author Training Search Email ©M.Lutz