pymimedetacher
Compact script to parse maildir structure, detach attachment and save them in a directory structure mirroring the mailbox folders.
It is based on python core-library mailbox (Manipulate mailboxes in various formats — Python 2.7.10 documentation).
Options
-h, --help
show help message and exit
-i PATH, --input=PATH
Input Maildir path to parse.
You easly can obtain a local copy of your IMAP mailbox with OfflineIMAP.
Some good tutorials on offlineimap setup specific to gmail:
-o OUTPATH, --output=OUTPATH
Output path to store the attachments, the subfolders will mirror the mailbox folder structure.
-d, --delete-attachment
Delete the attachments in the original mail, default is to leave there.
-s, --save_attachment
Save and decode the attachments files, default is do nothing.
-v, --verbose
Print more verbose output.