I hereby claim:
- I am schlos on github.
- I am schlossy (https://keybase.io/schlossy) on keybase.
- I have a public key ASBgfFRZjINgtFmiZf9e7WsFNzCFf23srdG_u6sxMAsgEQo
And finally, I am proving ownership of the github account by posting this as a gist.
// To load this script, open a Google Sheet (yeah, weird I know), then select "Tools->Script Editor" | |
// From there, past this content into a script. You can set up triggers to run this script every day at a certain time | |
// by selecting Resources -> Triggers. | |
// I recommend you set the trigger to every 5-10 minutes. This will let the batches complete. If the trigger is too infrequent, it wont have time to finish. | |
// https://developers.google.com/apps-script/reference/gmail/ | |
// For large inboxes (the ones you want to analyze) gmail will rate limit you. | |
// They recommend adding a sleep to call less, but then your exec time will be too long. | |
// To solve this, we run in batches. This is the batch size. Decrease this if exec time is too long. |
# This script, when used with Google Apps Scripts will delete 500 emails and can be triggered to run every minute without user interaction enabling you to bulk delete email in Gmail without getting the #793 error from Gmail. | |
# Configure the search query in the code below to match the type of emails you want to delete | |
# Browser to https://script.google.com/. | |
# Start a script and paste in the code below. | |
# After you past it in, save it and click the little clock looking button. This is for your triggers. You can set up how frequently you want the script to run (I did mine for every minute). | |
# Source : # https://productforums.google.com/d/msg/gmail/YeQVDuPIQzA/kpZPDDj8TXkJ | |
function batchDeleteEmail() { | |
var batchSize = 100 // Process up to 100 threads at once |
/* | |
This script watches a gmail account for any thread labeled with 'rtm'. When such a thread is found it | |
sends a task-creation email to Remember the Milk that includes a link back to the original thread. | |
To follow the link back to the email you have to be logged in to the originating Gmail account (which | |
is only an issue if you have multiple gmail accounts). Otherwise Google claims the email cannot be | |
found. | |
To install it go into Google Drive and create a new "Script" (the link is a bit hidden in the create submenu). | |
Copy this code into the new project and set a time-based trigger. |
/* paste into http://script.google.com | |
run periodically (e.g. every 5 minutes) with a timer by selecting 'Resources' > 'current project's triggers...' | |
*/ | |
function filterLongEmails() { | |
var num_messages = 1; // will be applied to the last n messages. Google allows up to 500 | |
var word_limit = 50; | |
var subj = "Shorter emails will get read."; | |
var body = "Dear friends, I value my time and yours but I appreciate it if you can keep your emails under " + word_limit + " words. Please edit and resend."; | |
/** | |
* Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a | |
* specific label). You can then setup ("timed") triggers in Apps Script (hourly, etc) to monitor your Inbox. | |
* How to Use: | |
* 1. Log into Google Drive account and create a Google Script. | |
* 2. Copy and paste the below snippet into the gs file. | |
* 3. Make sure to update the 'reminderLabel', 'calendarName' and 'reminderDuration' as per your preference. | |
* 4. Test the script to make sure it is working properly. | |
* 5. Setup a time-driven Project Trigger (hourly, etc) to automatically run this script and create calendar events. | |
* |
function GenerateDigest() { | |
//Function that goes through a search query based on time and optional label in gmail, strips html, collates into a single email, sends it to a desired address and then labels the emails as processed. | |
// Where the digest email is going | |
var to_emailAddress = "[email protected]"; | |
//We calculate the 24 hour range, I plan to run this every day at 9:00 to get last 24 hours of emails | |
var month = new Date().getMonth(); |
//TODO | |
//https://developers.google.com/apps-script/managing_triggers_programmatically | |
function moveDelayedMessages() { | |
receiveEmails("Delayed Messages"); | |
} | |
// receiveEmails() will take all threads in labelname (Default: 'Delayed messages') | |
// and place them into the mailbox. The intent is for a delayed retrieval of |
function moveDelayedMessages() { | |
receiveEmails("Delayed Messages"); | |
Utilities.sleep(60000); | |
reArchive(); | |
} | |
// receiveEmails() will take all threads in labelname (Default: 'Delayed messages') | |
// and place them into the mailbox. The intent is for a delayed retrieval of | |
// messages when combined with a script timer. | |
function receiveEmails(labelName) { |
function gmailAutoarchive() { | |
var delayDays = 2; // will only impact emails more than 48h old | |
var maxDate = new Date(); | |
maxDate.setDate(maxDate.getDate()-delayDays); // what was the date at that time? | |
// Get all the threads labelled 'autoarchive' | |
var label = GmailApp.getUserLabelByName("autoarchive"); | |
var threads = label.getThreads(0, 400); | |
I hereby claim:
And finally, I am proving ownership of the github account by posting this as a gist.