惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
爱范儿
爱范儿
罗磊的独立博客
美团技术团队
Jina AI
Jina AI
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
IT之家
IT之家
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Inbox Zero for Devs: How I Built a JavaScript Script to D...
Guadalupe Rosas · 2026-06-25 · via DEV Community

Hey dev community! 👋

As developers, our inboxes often turn into a graveyard of job alerts (LinkedIn, Indeed, ZipRecruiter) and tech newsletters we subscribe to with the intention of "reading later" but never actually open. The result? Important emails get lost, and we get the dreaded "Account storage is almost full" notification.

Recently, I hit that wall. I had thousands of accumulated emails. While Gmail allows you to create filters for incoming mail, it doesn't have a native feature to say: "Delete this email automatically after 7 days".

So, I decided to solve it the way we solve everything: by writing some code.

🛠️ The Solution: Google Apps Script + JavaScript

Since the Google Workspace ecosystem runs on a JavaScript-based environment, I put together a custom script. Fun fact: a simple loop originally failed due to Google's strict 6-minute execution limit. To fix this, I optimized the code to process emails in batches of 100, preventing the server from timing out.

Here is the final production-ready script:

function cleanSpamTsunami() {
// 1. Loop to delete ALL Job Board emails in batches of 100
var continueJobSearch = true;
while (continueJobSearch) {
var jobThreads = GmailApp.search('computrabajo OR indeed OR linkedin OR OCC OR neuvoo OR talent.com OR jooble', 0, 100);

if (jobThreads.length > 0) {
  Logger.log('Deleting a batch of ' + jobThreads.length + ' job alert emails...');
  GmailApp.moveThreadsToTrash(jobThreads);
} else {
  Logger.log('No more job alerts found!');
  continueJobSearch = false; // Break the loop
}

}

// 2. Loop to delete old Newsletters (older than 7 days) in batches of 100
var continueNewsletters = true;
while (continueNewsletters) {
var newsletterThreads = GmailApp.search('unsubscribe OR "cancelar suscripción" older_than:7d', 0, 100);

if (newsletterThreads.length > 0) {
  Logger.log('Deleting a batch of ' + newsletterThreads.length + ' old newsletters...');
  GmailApp.moveThreadsToTrash(newsletterThreads);
} else {
  Logger.log('No more old newsletters found!');
  continueNewsletters = false; // Break the loop
}

}

Logger.log('Deep clean completed successfully.');
}

⚙️ How to Set It Up in 3 Steps:

  1. Create the Script: Head over to script.google.com, create a new project, and paste the code.
  2. Authorize it: Click Run (the Play button ▶️) to authorize the script to access your account. > 💡 Note: Google will show a security warning because it's an unverified app. Don't worry—it's literally your own code. Just click **Advanced* -> Go to project (unsafe).*
  3. Automate it (The Trigger): On the left menu, click on Triggers (the Clock icon ⏰), select Add Trigger, and set it to run on a Time-driven event with a Daily timer scheduled between Midnight to 1 AM.

And that's it! Your inbox will stay clean, your storage optimized, and you'll hit a real automated Inbox Zero every single day.

What do you think? How do you handle inbox clutter or automate your dev environment? Let me know in the comments! 🚀


🏥 A Personal Note from the Author

Hey everyone, thank you so much for reading this far.

Writing code and automating solutions is my passion, but recently I had to undergo a major unexpected surgery that has me temporarily bedridden. As a Java developer and the main provider for my family, being unable to work during this recovery phase has been a tough financial and emotional challenge.

I rarely do this, but I have launched a GoFundMe campaign to help cover medical expenses and support my family while I get back on my feet and return to coding at 100%.

If you found this script helpful, or if it saved you some storage space today, please consider supporting or sharing my campaign. Every little bit counts and means the world to us right now. 🙏❤️

🔗 Support or share the campaign here: Help Adrian & His Family on GoFundMe