{"id":20833699,"url":"https://github.com/danamir/imap-attachment-extractor","last_synced_at":"2025-09-08T20:36:46.096Z","repository":{"id":56246543,"uuid":"157870615","full_name":"Danamir/imap-attachment-extractor","owner":"Danamir","description":"IMAP attachment exporter, with optional Thunderbird detach mode","archived":false,"fork":false,"pushed_at":"2022-08-18T13:58:54.000Z","size":41,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-08T01:42:42.799Z","etag":null,"topics":["attachment","attachment-extractor","imap","imap-client","thunderbird"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Danamir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-16T13:22:53.000Z","updated_at":"2024-02-15T06:46:15.000Z","dependencies_parsed_at":"2022-08-15T15:20:50.276Z","dependency_job_id":null,"html_url":"https://github.com/Danamir/imap-attachment-extractor","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Danamir/imap-attachment-extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danamir%2Fimap-attachment-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danamir%2Fimap-attachment-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danamir%2Fimap-attachment-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danamir%2Fimap-attachment-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Danamir","download_url":"https://codeload.github.com/Danamir/imap-attachment-extractor/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danamir%2Fimap-attachment-extractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231507,"owners_count":25245601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attachment","attachment-extractor","imap","imap-client","thunderbird"],"created_at":"2024-11-18T00:16:27.763Z","updated_at":"2025-09-08T20:36:46.064Z","avatar_url":"https://github.com/Danamir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imap-attachment-extractor\nIMAP attachment extractor, with optional Thunderbird detach mode.\n\n\n#### Prequisites\n\n- Python 3.x\n- Use keyring to store password on the system (_Optional_)\n\n\n#### Installation\n\n##### Installation from release :\n\n - Download and extract the latest [release](https://github.com/Danamir/imap-attachment-extractor/releases).\n - Open a terminal to the extracted directory.\n\n##### Installation from sources :\n\n```bash\n$ curl --location https://github.com/Danamir/imap-attachment-extractor/archive/master.zip --output imap-attachment-extractor-master.zip\n$ unzip imap-attachment-extractor-master.zip\n$ mv imap-attachment-extractor-master/ imap-attachment-extractor/\n$ cd imap-attachment-extractor\n```\n\n##### Setup :\n\nConfigure Python virtual environment :\n```bash\n$ python -m venv .env\n$ . .env/bin/activate  # on Linux \n-or-\n$ .env/Script/activate.bat  # on Windows\n```\n\nInstall :\n```bash\n$ python setup.py develop\n$ imap_aex --help\n-or-\n$ python imap_aex.py --help\n```\n\nUse configuration file _(optional but recommended)_ :\n```bash\n$ cp config.ini-dist config.ini  # on Windows use 'copy' instead of 'cp'\n```\n\n#### Running\n\nYou can use `imap_aex` either only with the CLI, or with the configuration file, or a combination of the two.\nWhen using both, the command line will override the options found in the configuration file.\n\nThe only mandatory arguments are `HOST` and `USER` (or `[imap]` section `host` and `user` in the configuration file).\n\n_First run with configuration file_ :  \nBy default the configuration template is in `dry-run` mode. You can force the execution in CLI with the `--run`\noption, or comment the `dry-run=yes` configuration line.\n\n##### Password handling\n\nYou can use `keyring` to store a password with the system secured library. Supported on Linux / Windows / MacOS :\n```bash\n$ keyring set imap_aex:\u003cHOST\u003e \u003cUSER\u003e\n```\n\nOr you can prompt the user for password on run with the `--password` option.\n\n##### Mozilla Thunderbird 'detach' mode\n\nIt is recommended to use the `--thunderbird` option if you use Mozilla Thunderbird. The extractor will then use the\nextended message headers `X-Mozilla-External-Attachment-URL` and `X-Mozilla-Altered` to link to the local extracted\nfile inside the modified message. This simulates the use of _Detach_ action on an attachment in Mozilla Thunderbird.\n\n##### Running options\n\nPlease refer to the CLI documentation. The configuration entries have the same name as the CLI options, but are\nplaced in specific section.\n\n_CLI only options (those options are not in the configuration file):_\n - `--conf=\u003cc\u003e` : Use a specific configuration file, otherwise use `config.ini`. Can be used to configure multiple\n                  hosts, each with its own configuration file.\n - `--help` : Display the CLI help, then exit.\n - `--list` : List the server folders and corresponding extraction paths, then exit.\n - `--run` : Force running, even if `dry-run` found in configuration file.\n \n##### CLI documentation\n```\nIMAP Attachment extractor.\n\nWorks on IMAP SSL server by replacing an email after extracting the attachments.\nUse keyring tool to store password. Initialize with 'keyring set imap_aex:\u003chost\u003e \u003cuser\u003e'.\n\nUsage: imap_aex [--help] [--verbose] [--debug] [--extract-dir=\u003ce\u003e] [--extract-only] [--folder=\u003cf\u003e] [--date=\u003cd\u003e] [options] [HOST] [USER]\n\nArguments:\n  HOST                      IMAP host name.\n  USER                      IMAP user name.\n\n\nOptions:\n     --all                  Fetch all mail from the folder. Not recommended, prefer '--date' use.\n  -c --conf=\u003cc\u003e             Optional configuration file, containing any of the command line options values. [Default: config.ini]\n  -d --date=\u003cd\u003e             Date defininition, formatted as [\u003c\u003e]date[to][date]. Date can be y, y-m, or y-m-d.\n                              - 2012-12-21 : on this day\n                              - 2012-12 : on this month\n                              - 2012 : on this year\n                              - \u003e2012 : since this year\n                              - \u003c2012-12-21 : before this day\n                              - 2012-04 to 2012-10 : between those months\n\n     --dry-run              Dump running information and leave the server intact.\n     --debug                Debug mode: append modified messages to the server, but don't delete the source message.\n     --dir-reg=\u003cr\u003e          Replace Regular expression to be applied before creating directories.\n                            Optional replacement separated by \"\u003e\u003e\", otherwise delete the match.\n                            Multiple expressions separated by \"::\".\n                              - ^INBOX\\/?                   Remove \"INBOX\" and \"INBOX/\" from subdirectory.\n                              - ^INBOX$\u003e\u003eInbox::INBOX\\/     Replace \"INBOX\" by \"Inbox\", and ignore it as subdirectory.\n                              - ^\\[Gmail\\]\\/?               Remove \"[Gmail]\" and \"[Gmail]/\" from subdirectory.\n                              - ^Drafts$\u003e\u003eBrouillons        Replace by translation.\n\n  -e --extract-dir=\u003cd\u003e      Extract attachment to this directory. [Default: ./]\n     --extract-only         Don't detach attachments, extract only.\n     --flagged=\u003cf\u003e          Flagged/starred mail behaviour: [Default: skip]\n                              - detach:     detach as a normal mail.\n                              - extract:    extract only, leave message intact.\n                              - skip:       don't extract, leave message intact.\n  -f --folder=\u003cf\u003e           Mail folder. [Default: INBOX]\n\n     --help                 Display this help message then exit.\n     --inline-images        Handle inline images as attachments.\n     --list                 List the server folders then exit.\n     --max-size=\u003cm\u003e         Extract attachments bigger than this size. [Default: 100K]\n     --no-subdir            Don't create folder subdirectories inside extract dir.\n     --password             Prompt for password instead of looking in the keyring.\n  -p --port=\u003cp\u003e             IMAP host SSL port. [Default: 993]\n     --run                  Force running, even if dry-run found in config file.\n     --thunderbird          Implements thunderbird detach mode, pointing to the extracted file local URL.\n  -v --verbose              Display more information.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanamir%2Fimap-attachment-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanamir%2Fimap-attachment-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanamir%2Fimap-attachment-extractor/lists"}