A powerful Python-based tool to automatically clean Gmail accounts by moving ONLY read emails from Inbox and Spam to Trash.
Gmail Read Cleaner Pro is designed to help users keep their Gmail accounts clean and organized.
It connects to multiple Gmail accounts and safely removes clutter by:
- Moving only read emails to Trash
- Keeping all unread emails untouched
- Supporting multiple accounts
- Allowing resume if interrupted
Perfect for users who receive large volumes of emails daily.
- Loads Gmail accounts from
credentials.json - Connects using IMAP (secure login)
- Scans:
- Inbox
- Spam folder
- Finds ONLY emails marked as READ (SEEN)
- Moves them to Trash (not permanently deleted)
- Saves progress to resume later
- 📬 Multi Gmail account support
- 🧹 Cleans Inbox and Spam folders
- 👁 Keeps unread emails safe
- 🔄 Resume functionality (state tracking)
- ⚡ Batch processing for speed
- 🛑 Safe interruption handling
- 🧪 Dry-run mode (simulation)
- 🔒 Secure login using App Passwords
- 📉 Minimal console output
- Python → Core language
- imaplib → Gmail IMAP connection
- json → Credentials & state storage
- os & sys → File handling
- socket → Network handling
- typing → Type hints
Create a credentials.json file:
[
{
"email": "your_email@gmail.com",
"app_password": "your_app_password"
}
]Use Gmail App Passwords Do NOT use your real Gmail password
git clone https://github.com/yourusername/Gmail-Read-Cleaner-Pro.git
cd Gmail-Read-Cleaner-Pro
Ensure Python 3.8+ is installed:
python --version
Uses only built-in Python libraries.
Run the script:
python main.py
Inside the script:
DRY_RUN = False
- True → Simulation only (no deletion)
- False → Actually moves emails to Trash
The tool creates:
- gmail_cleaner_state.json
This file stores:
- Last processed email UID
- Progress per account
So if interrupted, it resumes from where it stopped.
- Never deletes unread emails
- Does not permanently delete emails
- Moves emails to Trash only
- Supports dry-run testing
- Handles errors safely
- Run in batches (default optimized)
- Use stable internet connection
- Keep Gmail IMAP enabled
- Avoid running multiple cleaners at once
- Clean cluttered Gmail inbox
- Manage multiple email accounts
- Maintain productivity
- Reduce inbox overload
- Prepare accounts for automation
- Works only with Gmail
- Requires App Password
- Depends on IMAP access
- Cannot recover permanently deleted emails
- Never upload credentials.json to GitHub
- Use App Passwords only
- Keep your accounts secure
- Enable 2FA on Gmail
Malki Aman
If you find this project useful, give it a star ⭐
This tool is intended for personal and professional email management. Users are responsible for their data and Gmail usage policies.