In Gmail you must have noticed that all the emails in Trash and Spam folders get automatically deleted after fix duration (30 days) of time. This automatic deletion of emails from a folder is called automatic purging. With the help of auto purge property you can keep your mail folders clean.
Suppose if you have created a rule in Gmail which will allow to archive all your important (e.g. newsletter subscriptions) emails in a defined label. If these emails has no importance to you, then you would like to remove them but you have to do so manually. But if you have enabled auto-purging on this label, then these emails can get deleted automatically after the retention time.
Follow below mentioned steps to enable Auto-Purging in Gmail:
1. First open Google Script and choose File -> Make a copy to copy it into your Google Drive.
2. Now change value of GMAIL_LABEL to the label that you want to auto-purge. Also change te value of PURGE_AFTER to the number days for which you want keep emails in Gmail.
3. Now move to Run -> Initialize and accept all the required permissions.
4. Finaly move to Run -> Install to install the auto-purge script.
So by following above mentioned steps, you have enabled auto-purging. Also whenever you want to disable this auto-purge script, just open the same script in Google drive and select Run -> Uninstall.
Via: labnol