title: I received an email titled: [Action Required] Policy Changes for Projects that Use Restricted Gmail API Scopes
body: <p>I have a GMAIL Script I found and adapted named PURGEGMAIL. Available for users.   I use it for myself and SHARED the script with my wife's Google Gmail Acct to cleanout our old emails nightly from various labels. I received an email from Google Apps Developers  requesting that I submit the project for verification.
  I am just a simple GMAIL user, not a developer. The script is a life saver.</p>
  
  <p>I goto this screen: <a href="https://console.cloud.google.com/apis/credentials/consent?project=api-project-865788727416" rel="nofollow noreferrer">https://console.cloud.google.com/apis/credentials/consent?project=api-project-865788727416</a> that needs me to do an OAUTH consent Screen.  There is a scope for Google API: <a href="https://mail.google.com/" rel="nofollow noreferrer">https://mail.google.com/</a> which I believe needs to be authorized. Since I'm not a developer or a GSUITE user just plain old GMAIL user.  What do I do to get the VERIFIED as they requested?  They say I could loose access on 2/15/19.  H E L P.</p>
  
  <p>Source follows:</p>
  
  <pre><code>// Purge messages automatically after how many days?
  //var PURGE_AFTER = "12";
  
     function runPurge () {
     purgeGmail("tmpnews","14");
     purgeGmail("TmpFree","14");
     purgeGmail("Tmpstores","14");
     purgeGmail("sent","87");
  }
  
  /*
  
   For details, refer http://labnol.org/?p=27605
  
  
   T U T O R I A L
   - - - - - - - - 
  
   Step 1. Update the values of fields GMAIL_LABEL and PURGE_AFTER above.
  
   Step 2. Go to Run -&gt; Initialize and authorize the script.
  
   Step 3. Go to Run -&gt; Install to install the script.
  
   You can now exit this window and any email messages in Gmail folder will automatically 
   get purged after 'n' days. The script will run by itself everyday at 01:00 hours.
  
   Also, you may go to Run -&gt; Uninstall to stop the purging script anytime.
  
  
  */
  
  function Intialize() {
   return;
  }
  
  function Install() {
  
   ScriptApp.newTrigger("runPurge")
            .timeBased()
            .at(new Date((new Date()).getTime() + 1000*60*2))
            .create();
  
   ScriptApp.newTrigger("runPurge")
            .timeBased().everyDays(1).create();
  
  }
  
  function Uninstall() {
  
   var triggers = ScriptApp.getScriptTriggers();
   for (var i=0; i&lt;triggers.length; i++) {
     ScriptApp.deleteTrigger(triggers[i]);
   }
  
  }
  
  function purgeGmail(GMAIL_LABEL,PURGE_AFTER) {
  
   var age = new Date();  
   age.setDate(age.getDate() - PURGE_AFTER);    
  
   var purge  = Utilities.formatDate(age, Session.getScriptTimeZone(), "yyyy-MM-dd");
   var search = "label:" + GMAIL_LABEL + " before:" + purge;
  
   try {
  
     var threads = GmailApp.search(search, 0, 200);
  
     if (threads.length == 200) {
       ScriptApp.newTrigger("runPurge")
                .timeBased()
                .at(new Date((new Date()).getTime() + 1000*60*10))
                .create();
     }
  
     for (var i=0; i&lt;threads.length; i++) {
       var messages = GmailApp.getMessagesForThread(threads[i]);
       for (var j=0; j&lt;messages.length; j++) {
         var email = messages[j];       
         if (email.getDate() &lt; age) {
           email.moveToTrash();
         }
       }
     }
  
   } catch (e) {}
  
  }
  </code></pre>