We’ve all been there. You look at that little number next to your Inbox—maybe it’s 500, maybe it’s 35,000—and you feel that spark of “digital dread.” As a professional, that number isn’t just clutter; it’s a wall between you and the work that actually matters.
Manual cleaning is a nightmare. Gmail’s UI often lags when you try to select thousands of threads, and the fear of accidentally trashing a critical project update is real.
As someone deep in UX and Accessibility, I view a cluttered inbox as a design failure. It creates unnecessary cognitive load and acts as a barrier to focus. If our tools don’t make it easy to maintain a clean environment, we have to build our own solutions. I decided to treat my inbox like an accessibility problem: Remove the noise, keep the signal.
The “Safety-First” Cleanup Script
This Google Apps Script acts as a surgical tool. It targets high-volume “noise” categories but strictly ignores any domain you deem “Safe.” Copy and paste the following into your Google Apps Script editor:
/**
* Safe Inbox Purge Script
* Author: Rajath Tirumangalam (rajathtirumangalam.com)
* Strategy: Target high-volume categories while protecting critical domains.
*/
function mySafeInboxCleanup() {
// 1. YOUR SAFE LIST (The "Never Delete" list)
// PLACEHOLDER: Replace these with the domains you want to protect.
var safeDomains = [
"your-work-domain.com", // Your professional email
"your-bank.in", // Critical financial alerts
"school-alerts.edu", // Family/Education
"gmail.com" // Keep personal Gmail-to-Gmail threads
];
// 2. TARGET CATEGORIES
var categories = "(category:promotions OR category:social OR category:updates)";
// 3. BUILDING THE SEARCH
var exclusions = "-from:(" + safeDomains.join(" OR ") + ")";
var finalQuery = "label:inbox " + exclusions + " " + categories;
Logger.log("Searching for: " + finalQuery);
// 4. BATCH PROCESSING
for (var i = 0; i < 10; i++) {
var threads = GmailApp.search(finalQuery, 0, 100);
if (threads.length > 0) {
Logger.log("Batch " + (i+1) + ": Moving " + threads.length + " noisy threads to trash...");
GmailApp.moveThreadsToTrash(threads);
} else {
Logger.log("Inbox is clean! No more matching threads found.");
break;
}
}
}
How to Make This Script Your Own
- Update your “Safe List”: Replace the placeholders in the
safeDomainsarray with domains like your bank or employer. Ensure each is in quotes and separated by a comma. - Why the “Batch” of 100? Google limits how many threads can be trashed in one call. This ensures the script runs smoothly without errors.
- The Safety Net: This script moves mail to the Trash, giving you a 30-day window to recover anything accidentally caught.
The UX Takeaway
Digital inclusion isn’t just about how we build software; it’s about how we manage our own digital environments so they don’t overwhelm us. Good design should foster focus. Until our email providers give us a “Surgical Delete” button, a few lines of code can be the bridge to a calmer workday.
#TheInvisibleUser #DigitalAccessibility #UXDesign #Productivity #GmailAutomation #TechLeadership
Leave a Reply