We live our lives on a schedule (or try to, anyway)—so why not apply the same philosophy to your inbox? The Google Apps Script lets you automatically archive or delete old emails that are clogging up your inbox based on a schedule you create. The result? Time-based events that will move, mark or label messages—and you don’t even have to open your mail client!
I can hear your excitement. You’re ready to set it up, aren’t you? Let’s dive in with a hypothetical example. Say you want to get rid of deals, promotional emails or notifications that are two days old. To accomplish this, you’ll need to follow two steps:
1) Create a “delete me” Gmail filter and populate the search options to catch your semi-spam as it arrives.
2) Create a script that will delete all messages from the “delete me” label older than two days.
Notice that, in the second line, you have the option to change the number of delay variables to specify how many days should pass before that particular matched message will be deleted from your inbox.
When you’ve filled in the variables, save the script, name your project and click Run. After that, Google will ask you to authorize the script to access your Gmail account. Your final step is the schedule the interval at which you want the script to run. Simply go to the Resources menu and select your desired interval.
Now that you’ve cleaned up older emails, what about the rest of your inbox? Don’t worry—there’s a script for that! You can easily archive older emails from your inbox using the Google Script here:
Simply copy and paste the script into https://script.google.com, specify your intervals and you’re set!
A quick note? If you want to clean up thousands of email messages, know that it will take time for the script to fully work. If you’d rather tackle your inbox in smaller batches, follow John’s steps to process email threads in groups of 100.
What do you think? Ready to give Google Apps Script a try? Be sure to let us know how it works. And if you have any other email management tips or tools, don’t be shy—give us the scoop!