With a little bit of help from ChatGPT and trial-and-error, I have a script that helps me keep my Gmail accounts more organized.
I have five labels:
**0**, **1**, **2**, **3** and **4**
What the script does:
For mail over 12 hours old, add label **0** and **1**
For mail over 30 days old, remove label **1** and add label **2**
For mail over 90 days old, remove label **2** and add label **3**
For mail over 1 year old, remove label **3** and add label **4**
For any mail that's read, flip it back to unread.
It runs every hour. (Label **0** is a holdover from something else and it's less important.)
Anyhow, this allows new emails to come into my inbox and if I deal with them right away (that is, I delete them), then everything's good. If it's not something I can handle right away, it moves out of the inbox.
It means when I open my mail on my phone, it's never going to be overwhelming, it's just going to be the new stuff. (I have other filters that move a lot of commercial/bulk mail out of the inbox right away because I don't need to be alerted about sales coupons.)
- Open your Gmail account in a web browser.
- Click on the gear icon in the top right corner and select "View all settings".
- Go to the "Advanced" tab.
- Scroll down to the "Desktop notifications" section and enable the "Allow external programmatic access to Gmail" option.
- Click "Save Changes" at the bottom of the page.
- Open the Google Apps Script editor by visiting https://script.google.com/.
- Create a new script file and replace the default content with the script provided above.
- Save the script and give it a name (e.g., "EmailProcessor").
- Click on the clock icon in the toolbar to set up a time-driven trigger.
- Configure the trigger to run the processEmails function at your desired interval (e.g., every hour, every day).
- Save the trigger and confirm any necessary permissions.
No comments:
Post a Comment