Saturday 1 October 2016

Automatically purge email from Gmail.

Here's a quick script I've knocked up that will purge/permanently email on a schedule that have a particular label and are in the trash/bin.

Make a copy of the script. Edit the parameters as required.

/*
  ****************************************************************************
  Name:PurgeGmail
  Version 1.01
  Date: 30/9/16
  Description: Script that will run automatically and permanently mail message
               based on a label + Bin 
  Author: Rob Ardill - G Guite Top Contributor
  Credits: Based on script http://www.labnol.org/internet/gmail-auto-purge/27605/
  Requires: Advanced Google Services + Gmail API enabled
  
  **************************** !!! IMPORTANT !!! ******************************
  
                     THIS SCRIPT WILL PERMANENTLY DELETE EMAIL.
                     NO WARRANTY PROVIDED OR LIABILITY ACCEPTED
                     INCORRECT USE OF THIS SCRIPT CAN LEAD TO LOSS
                     OF EMAIL!
  
  ****************************************************************************

INSTRUCTIONS
  
  1. Update the values of the field GMAIL_LABEL.
  2. Go to Resource -> Advanced Google Services and enable Gmail API.
  3. Go to Run -> Initialize and authorize the script.
  4. Go to Run -> Install to install the script.
  
  Follwign step 4, the script will now be active and will run every day at 1am permanently removing any email that is in the trasb/bin and with the GMAIL_LABEL.
  If there are more than 100 items to remove it will do so in batches of 100 every 2 minutes.
  
  * If you want the script to run more frequently, you can adjust the trigger in the Function Install()
  
MANUAL USE
  
  To manually run the script follow the above steps 1 to 3, then Go to Run -> purgeGmail
  
UNINSTALL

  To unistall the script go to Run -> Uninstall to stop the purging script anytime.

*/

https://script.google.com/d/1cyYaIvxV038OB4QRYU0gisLhJVADQi4EHE2QaGYnBdI1ImD0YmKnc16G/edit?usp=sharing