Bulk delete Gmail messages before a specified date
---
**📧 Gmail Bulk Delete - Automated Mass Email Deletion**
**Description:**
A powerful Tampermonkey script that automates bulk deletion of Gmail emails based on date ranges. Features a sleek cyberpunk-inspired UI with black and purple gradients, glowing effects, and real-time deletion progress. Perfect for cleaning up old emails from specific time periods without manually selecting and deleting batches.
**✨ Features:**
- 🎨 Beautiful purple/black gradient UI with glowing effects
- 📅 Date range selection (delete emails before a specific date, optional stop date)
- 🔍 Optional search query filtering (e.g., from specific senders)
- 🤖 Fully automated - continuously deletes batches until completion
- 📊 Real-time progress tracking with deletion counter
- ⚡ Smart detection - automatically detects when all emails are deleted
- 🛑 Stop button to halt deletion at any time
- 💾 Shows final completion alert only when finished
**📋 Installation Instructions:**
1. **Install Tampermonkey Extension:**
- Chrome: https://chrome.google.com/webstore (search "Tampermonkey")
- Firefox: https://addons.mozilla.org/firefox (search "Tampermonkey")
- Edge: https://microsoftedge.microsoft.com/addons (search "Tampermonkey")
2. **Add the Script:**
- Click the Tampermonkey icon in your browser
- Click "Create a new script"
- Delete the default code
- Paste this script
- Press Ctrl+S (or Cmd+S on Mac) to save
3. **Navigate to Gmail:**
- Go to https://mail.google.com
- The purple control panel will appear in the top-right corner after a few seconds
**🎯 How to Use:**
1. **Set Your Date Range:**
- **"Delete emails before (start)"**: Set this to the cutoff date (e.g., 2025-11-24 to delete everything before today)
- **"Stop at date (optional)"**: Leave empty to delete ALL emails before start date, OR set to a specific date to only delete emails within a range (e.g., set start to 2025-11-24 and stop to 2022-01-01 to delete only emails from 2021 and older)
2. **Add Filters (Optional):**
- Use the "Search query" field to target specific emails
- Examples:
- `from:[email protected]` - delete emails from specific sender
- `subject:receipt` - delete emails with "receipt" in subject
- `has:attachment` - delete emails with attachments
- Leave empty to delete all emails in date range
3. **Start Deletion:**
- Click the "Start Delete" button
- The script will automatically:
- Navigate to the search results
- Select 50 emails at a time
- Click the delete button
- Wait for Gmail to process
- Load the next batch
- Repeat until no emails remain
4. **Monitor Progress:**
- Watch the "Status" field for current action
- See deletion count in real-time
- Click "Stop" to halt at any time
5. **Completion:**
- When finished, you'll see a single alert: "✅ Deletion complete! X emails deleted"
- Deleted emails go to Trash (30-day recovery period)
**⚠️ Important Notes:**
- **This permanently deletes emails** (they go to Trash first with 30-day recovery)
- **Verify you're on the correct Gmail account** before starting
- **Test with a small date range first** to ensure it works as expected
- The script processes 50 emails per batch automatically
- Gmail may rate limit if deleting thousands of emails - if this happens, stop and resume later
- Keep the browser tab active while deletion is running
**🔧 Troubleshooting:**
- **Delete button not found?** Check browser console (F12) for debug info showing available buttons
- **Script not appearing?** Refresh Gmail page and wait 2-3 seconds
- **Deletion stopped unexpectedly?** Click "Start Delete" again to resume
- **Wrong emails being deleted?** Stop immediately and check your date range and search query
**💡 Pro Tips:**
- Use date ranges to clean up old promotional emails while keeping recent ones
- Combine with search queries for surgical deletion (e.g., `from:[email protected] before:2024/01/01`)
- Empty your Trash folder after deletion to free up storage permanently
- Run during off-peak hours if deleting large quantities
**🎨 UI Customization:**
The script features a cyberpunk aesthetic with:
- Dark gradient background (black to navy)
- Purple (#a855f7) glowing borders and accents
- Animated hover effects
- Gmail trash icon integration
- Clean, modern typography
Enjoy your clean inbox! 🚀