Delete or trash multiple Gmail messages using Gmail queries.
- subject:Achieve your goals
- in:spam
- before:2019/01/01 is:unread
- label:productivity
Check out more search operators you can use in Gmail queries.
Before running this script you will need to create a project on the Google Cloud Platform and allow it to use the Gmail API. The steps to do that can be found here. You will also need authorization credentials for your desktop application. The steps for that can be found here. While configuring OAuth, you can select External
application and create credentials for a Desktop application at the relevant prompts.
After these steps, you should have a JSON file with your client secret and other credentials. Download this file into server/api-access/
and name it credentials.json
. The tokens.json
file will be generated for you automatically once you sign in using your Gmail account.
After cloning the repository, run the following commands in the server
folder:
npm init
npm install googleapis@39 --save