69 lines
3.7 KiB
Markdown
69 lines
3.7 KiB
Markdown
# noneroll
|
||
|
||
This Google Apps Script moves your low priority (promotional, social, political, etc.) emails in Gmail to a custom label and sends you a daily synopsis of received emails for review. Basically, this is `unroll.me` without any third-party access or [creepy data brokering](https://archive.is/30hj9).
|
||
|
||
## New Features & Improvements
|
||
|
||
- **Global Constants:**
|
||
Configure the script easily by setting global constants for your spreadsheet ID, sheet name, Gmail label, and email digest time range.
|
||
|
||
- **Performance Enhancements:**
|
||
The script now uses JavaScript Sets and batch updates (instead of multiple `appendRow` calls) to handle larger datasets more efficiently. My personal instance of this script filters messages from almost 1300 email addresses.
|
||
|
||
- **Automatic Deduplication:**
|
||
A new `dedupeEmails` function is included to automatically remove duplicate email addresses from your spreadsheet. You can schedule this to run periodically.
|
||
|
||
- **Improved Unsubscribe Link Extraction & HTML Template:**
|
||
The unsubscribe link extraction has been refined, and the HTML template now uses centralized CSS.
|
||
|
||
- **Modern Code Practices:**
|
||
The script has been updated with ES6 syntax (`const`, `let`, for‑of loops) for improved clarity and maintainability.
|
||
|
||
## Configuration
|
||
|
||
1. **Create a Google Sheet:**
|
||
Create a new spreadsheet in Google Sheets. This spreadsheet will be used to keep track of low priority email addresses.
|
||
|
||
2. **Create a Gmail Label:**
|
||
Create a new Gmail label (e.g., `zbulk`).
|
||
If you use a different label, update the `ZBULK_LABEL` constant in the script accordingly.
|
||
|
||
3. **Set Up the Google Apps Script Project:**
|
||
- Create a new Google Apps Script project.
|
||
- Copy the updated code into the project's `Code.gs` file.
|
||
- Replace the placeholder `SHEET_ID` (currently set to `'sheetID'`) with the actual ID of the spreadsheet (the string between `spreadsheets/d/` and `/edit` in your sheet's URL).
|
||
- Update `SHEET_NAME` if your target sheet name differs from the default ("Sheet1").
|
||
|
||
4. **Configure the HTML Template:**
|
||
- Include the updated HTML file named `email.html` in your project. This file controls the appearance of your daily digest.
|
||
|
||
5. **Set Up Triggers:**
|
||
Configure time-driven triggers for:
|
||
- **`arch`:** Every 15 minutes (or as desired)
|
||
Archives, labels, and marks low priority emails as read.
|
||
- **`addEmail`:** Daily (e.g., between midnight and 1am)
|
||
Batches and appends new email addresses to your spreadsheet.
|
||
- **`noneroll`:** Daily (e.g., between 5 and 6am)
|
||
Sends a digest email summarizing emails from the past 24 hours.
|
||
- **`dedupeEmails`:** Weekly (every Sunday, between 11pm and midnight)
|
||
Automatically deduplicates the email list in your spreadsheet.
|
||
|
||
## Usage & Maintenance
|
||
|
||
- **Tagging Emails:**
|
||
Tag any emails you wish to include in your low priority digest with your chosen Gmail label (e.g., `zbulk`).
|
||
|
||
- **Spreadsheet Data:**
|
||
Column A of your spreadsheet will be populated with the email addresses of low priority senders.
|
||
The script’s `addEmail` function should prevent duplicate entries, but the `dedupeEmails` function will periodically clean up any accidental duplicates.
|
||
|
||
- **Disabling Low Priority Flag:**
|
||
To stop an email from being flagged as low priority, remove its corresponding email address from your spreadsheet and (for safety) remove the label from any related messages in Gmail.
|
||
|
||
- **Performance Considerations:**
|
||
The updated script handles thousands of entries efficiently. For extremely large datasets, consider archiving older data or scheduling deduplication more frequently.
|
||
|
||
## Credits
|
||
|
||
Forked from [a GitHub project by Niraj D](https://github.com/nirajd/noneroll). Thanks for making this possible! 🙌🏻
|