Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gmailextract

Gmail cleanup tool that extracts old emails with large attachments before deleting them, so nothing is lost.

What it does

Phase 1 — scans Gmail for emails older than N years (default: 5) with attachments, saves each as a .eml file alongside its extracted attachments, organised by year. Generates a CSV report of everything found.

Phase 2 — after you've verified the exports and uploaded them somewhere safe, moves those emails to Gmail Trash.

Quick start

# Requires: Python 3.10+, Gmail IMAP enabled, and an App Password
# https://myaccount.google.com/apppasswords

export GMAIL_USER="you@gmail.com"
export GMAIL_APP_PASSWORD="xxxx xxxx xxxx xxxx"

python3 gmail_extract.py --dry-run   # preview scope
python3 gmail_extract.py             # extract
# → review output/extraction_report.csv
python3 gmail_trash.py --dry-run     # verify count
python3 gmail_trash.py               # move to Trash

See SETUP.md for full instructions including how to enable IMAP and create an App Password.

Key flags

Flag Default Effect
--dry-run off Scan only, write nothing
--years N 5 Only emails older than N years
--min-kb N 500 Minimum message size in KB
--limit N unlimited Cap for testing

About

Gmail cleanup tool. Phase 1 extracts emails older than N years (default: 5) with large attachments, saving both the full .eml and attachments organised by year. Phase 2 moves those emails to Trash after you've verified the exports. Generates a CSV report for review before any deletion occurs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages