
Google quietly turned your inbox into a subscription.
Back in 2013, Google stopped the era of ever-expanding free storage. Then on June 1, 2021, they dropped the hammer: unlimited “High Quality” photo backups ended, and Gmail, Drive, and Photos were merged into a single shared 15 GB cap. Upload a photo, lose inbox space. Get a big attachment, lose Drive space. Hit the limit and — this is the part people don’t realize — Google starts blocking your incoming emails.
The whole thing is a funnel into Google One, their paid storage subscription. And it works, because most people don’t know there’s another option.
There is. If your inbox is bloated with years of promotional emails, newsletters, and notifications you never asked for, you don’t need to buy more storage. Delete the junk. Google Apps Script can wipe everything matching a search query in one shot. Here’s how:
- Go to script.google.com
- Create a new project
- Paste this code:
function deleteMsgs() {
var threads = GmailApp.search('category:promotions is:unread', 0, 500);
for (var i = 0; i < threads.length; i++) {
threads[i].moveToTrash();
}
// If we got a full batch, there's probably more — schedule another run
if (threads.length === 500) {
scheduleNextRun();
} else {
// Done — clean up any lingering triggers
deleteExistingTriggers();
}
}
function scheduleNextRun() {
deleteExistingTriggers(); // avoid stacking duplicates
ScriptApp.newTrigger('deleteMsgs')
.timeBased()
.after(1000) // 1 second delay
.create();
}
function deleteExistingTriggers() {
var triggers = ScriptApp.getProjectTriggers();
for (var t = 0; t < triggers.length; t++) {
if (triggers[t].getHandlerFunction() === 'deleteMsgs') {
ScriptApp.deleteTrigger(triggers[t]);
}
}
}
- Save and click Run
That’s it. It processes everything matching the query at once and moves it to trash.
A few notes
- Swap out the search query —
'category:promotions is:unread'is just an example. You can use any valid Gmail search string, like'from:newsletter@example.com'or'subject:unsubscribe older_than:1y'. - It might time out — Apps Script has a ~6 minute execution limit, however the function will automatically schedule itself to run again if it doesn’t complete within the time limit.
- Check trash before emptying —
moveToTrash()sends things to trash, not permanent deletion. You can review and then empty trash, or let Gmail auto-purge after 30 days.
This approach works for any bulk Gmail cleanup job — old newsletters, order confirmations, notifications from services you no longer use, etc. Just adjust the search query.
Sources
- Updating Google Photos’ storage policy to build for the future — Google Blog
- 4 things to know about Google Photos’ storage policy change — Google Blog
- What Happens To Emails When Gmail Is Full — Clean Email
- How your Google storage works — Google Support