# Gmail: delete old emails
Automatically deletes old emails that match the specified label.
## Get started
- Create a new Google Apps Script at [https://script.google.com](https://script.google.com)
- Overwrite the placeholder with the javascript below
- Update the following constants:
- `LABEL_TO_DELETE`: the label that should be have old messages deleted
- `DELETE_AFTER_DAYS`: the age of messages after which they will be moved to trash
- Save the script, then run:
- `Initialize`
- `Install`
If you ever want to remove the script, run `Uninstall` to remove any left over triggers.
Gmail: delete old emails
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.