Skip to content

A Google Apps Script to auto clean Gmail Box by moving emails to Trash

License

Notifications You must be signed in to change notification settings

codedevdev/GmailCleaner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Gmail Cleaner

This script will help you delete old emails inside your Gmail Mailbox by moving them to trash. It deletes emails based on the Gmail Queries mentioned inside searches. The default script will delete the emails that are-

  1. Inside default Gmail Cetegories
  2. Unread
  3. Not starred
  4. Not in Trash
  5. Don't have attachments
  6. Not marked important
  7. Older than 7 days

The default filters are kept in place to keep your important emails safe. So, please ensure that your important emails don't match all the above criteria.

For example, I star all my important email threads which won't be deleted by the script.

Google permanently deletes mails from Trash after 30 days.

You can add a gmail query.More info on Gmail Queries Given below-

The script is efficient version of the code snippet from following blog post-

A cleaning robot for your Gmail inbox

Technology/Framework/Tools

Getting Started

Create a Google Apps Script project at https://script.google.com/ using the contents of GmailCleaner.gs.

Under Edit > Current project's triggers, schedule the script to run on a recurring basis. (e.g. "Time-driven", "Minutes timer", and "Every 15 minutes")

To continue learning about how to extend Google Docs, Sheets and Forms with Apps Script, take a look at the following resources:

Authors

  • Omkar Marathe - Initial work - Omkar

Support/Contributing

If you've found an error in this sample, please file an issue here

Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.

General questions about Apps Script can be asked on StackOverflow: google-apps-script on StackOverflow

General Apps Script bug reports or feature requests should be directed to the Apps Script Issue Tracker: google-apps-script-issues

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A Google Apps Script to auto clean Gmail Box by moving emails to Trash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%