a0e7a494e4
Single-file Python script to download emails from IMAP servers: - Downloads emails as .eml files preserving folder structure - Extracts attachments to zip files - Supports SSL and STARTTLS connections - Incremental updates using UID tracking (default behavior) - Multi-account support with separate folders per email - Safety checks to prevent duplicate downloads Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
911 B
911 B
Simple IMAP downloader
A single file Python script to download all emails from an IMAP inbox into single EML files, one per email, into a folder structure representing the same folder structure in the IMAP inbox
Arguments
Mandatory:
--server --email --user --password
Optional (if not supplied, use sensible defaults)
--ssl or --starttls (either allowed but not both) --port
Environment
There is a virtual Python environment set up in .venv - use it
Additional requirements
- limit the number of returned emails with '--limit xxx' - this is mainly to be used for debugging purposes
- ensure that file attachments (if available) are downloaded as well - zip these up into a single zip file and name it after the downloaded .eml file but with .zip instead
- keep track of the latest email downloaded - if
--updateis specified then just pull back emails newer than the last email downloaded