{"id":19854154,"url":"https://github.com/depayfi/mac-mails-parse-export-csv-json","last_synced_at":"2026-03-11T05:01:52.687Z","repository":{"id":114226873,"uuid":"530196365","full_name":"DePayFi/mac-mails-parse-export-csv-json","owner":"DePayFi","description":"Parse \u0026 extract Mail app (Mac OS) emails \u0026 save to structured CSV or JSON","archived":false,"fork":false,"pushed_at":"2022-09-19T11:49:20.000Z","size":580,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-18T14:53:08.169Z","etag":null,"topics":["apple-mail","macos-mail","mail","mail-extractor","mail-parser","mail-to-csv","mail-to-json"],"latest_commit_sha":null,"homepage":"","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/DePayFi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://tip.depay.com/6KFBECVsokSt0UKOAug8CI"}},"created_at":"2022-08-29T11:49:51.000Z","updated_at":"2024-08-14T14:11:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ba2ce74-1218-43e1-afb9-41837f3fdf2e","html_url":"https://github.com/DePayFi/mac-mails-parse-export-csv-json","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DePayFi/mac-mails-parse-export-csv-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fmac-mails-parse-export-csv-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fmac-mails-parse-export-csv-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fmac-mails-parse-export-csv-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fmac-mails-parse-export-csv-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DePayFi","download_url":"https://codeload.github.com/DePayFi/mac-mails-parse-export-csv-json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fmac-mails-parse-export-csv-json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30372125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"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":["apple-mail","macos-mail","mail","mail-extractor","mail-parser","mail-to-csv","mail-to-json"],"created_at":"2024-11-12T14:08:47.108Z","updated_at":"2026-03-11T05:01:52.670Z","avatar_url":"https://github.com/DePayFi.png","language":"Python","funding_links":["https://tip.depay.com/6KFBECVsokSt0UKOAug8CI"],"categories":[],"sub_categories":[],"readme":"# Mac OS Mail - Email Extractor \n## Mail App Emails to CSV or JSON\n\n**What it (currently) does:**\n\nEmail Export from Apple's Mail App on Mac OS -\u003e Plaintext input -\u003e Parse/Extract -\u003e Save to CSV or JSON\n\n*Sometimes it can be handy to get structured data from a mailbox on Mac OS (Mail). This is a quick (still) hacky script which parses a plaintext export email export from the Mail app in Mac OS and returns a structured CSV.*\n\n## Features\n- **TXT mode**: Parse manually exported emails from a txt file.\n- **EMXL mode**: Parse emlx files created by the Mail app\n- Export formats \u0026 versions per script execution\n  - Export versions\n    - \"plain\"\n    - \"exploded\": email addresses are split in case of multiple email recipients, each row contains only one receiving address (all other fields are duplicated)\n  - Formats (for each version)\n    - CSV\n    - JSON\n- Custom Columns based on Regex-extraction:\n  - Custom regex extraction schemes can be defined in `config.py`:\n    ![](assets/custom_regex.png)\n\n## Input (text file mode)\n1. Select the emails you want to parse in Mac OS Mail (hold shift in order to select multiple, CMD + A in order to select all from the current mailbox)\n2. File \u003e Save As \u003e Select Format: Plain Text \u003e Save to the script directory \u0026 rename to \"input.txt\"\n\n## Input (emlx parser mode)\nEdit the config.py file with your Mac OS filepath to your Mailbox that you want to extract email data from\n\n## Run\n\u003e Tested with Python 3.10.6\n\n```\npip install -r requirements.txt\n```\n1. edit config.py\n2. run either in **txt file mode:**\n\n\n```\nrename your txt file input.txt, place in script dir, then execute:\npython3 extract_txt.py\n```\n\nor \n1. run in emlx parser mode:\n\n```\ndon't forget to edit config.py first, then execute:\npython3 extract_txt.py\n```\n\nif you want to use a CLI with args \n(implementation in progress)\n\n```\npython3 mac-os-extract-mails.py\n\n[Options]\n-e : run emlx parser\n-t : run txt file parser\n-c : open config file for editing\n-sinput: select input file for txt file parser\n-sodir: select folder for outputs\n```\n\n## Outputs\n![](assets/output_structure.png)\n\n## Output Columns\n\n```\n\n- \"date_utc\"\n- \"date_iso\"\n- \"date\"\n- \"from\"\n- \"from_name\"\n- \"from_mail\"\n- \"subject\"\n- \"to\"\n- \"to_name\"\n- \"to_mail\"\n- \"from\"\n- \"reply_to\"\n- \"reply_to_name\"\n- \"reply_to_mail\"\n- \"body\"\n- \"x-universally-unique-identifier\"\n- \"message-id\"\n- \"mime-version\"\n- \"content-type\"\n\n```\n\n## Todo\n\n- [x] Plaintext mode\n- [x] Emlx mode\n- [x] Explode outputs: Split multiple recipient email addresses into separate data rows (1 email = 1..* rows). Currently: 1 row = 1 email, recipient email addresses are comma-separated\n- [x] Custom columns from RegEx outputs\n- [x] Export json\n- [ ] Command line tool\n- [ ] EMXL mode: Add caching\n- [ ] EMXL mode: Add mailbox folder picker (tkinter?)\n- [ ] TXT mode: Add file picker for input file (+cli path option)\n- [ ] Option: Create Google Sheet from Outputs\n- [ ] Option: Setting utc min-date\n- [ ] Option: Ignore Signatures\n- [ ] Option: Traverse all mbox'es if a mail box for mail account folder is undefined\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepayfi%2Fmac-mails-parse-export-csv-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepayfi%2Fmac-mails-parse-export-csv-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepayfi%2Fmac-mails-parse-export-csv-json/lists"}