[Gmail-tip] Delete reminders automatically when they are old

a.obhof says:
I am forgetful, so I appreciate all kinds of reminders.
That's why I use the reminder service of RTM
( You can find a brief introduction here: https://www.rememberthemilk.com/help/guide/reminders/)
I use the email reminder to get a daily due-today-todo-list, a reminder when the task is due and a reminder 30 Minutes before it is due - just in case that I've forgot about it.
Besides my forgetfulness I am lazy and I don't delete all those reminders. I don't want to keep them either. Nothing is more worthless than old news or outdated reminders.
You cannot use the filter function in GMail because there is no way to filter for messages relatively to a specific date, e. g. before:today.
(see for instance http://productforums.google.com/forum/#!topic/gmail/GQgHrvqYMmE)
Here's a script to delete all the reminders *automatically* within Gmail.
( You can find a brief introduction about scripts in google here: https://developers.google.com/apps-script/guide
Don't worry, it's quite intuitive.
)
Just add the script and add a trigger (time driven, e. g. dayly at 1 am) to run the script.
I also clean my inbox out from old calender notifications.
If you don't like that, just delete 'from:calendar-notification@google.com' from searchStr.
btw, emails from yesterday or older are old.
-- begin script --
function CleanGmailCalRTM(){
try{
// get the date of today:
// You can modify the todayStr string to build a date for your own needs. However Gmail needs the format YYYY/MM/DD
// note: 5F is hex for "-", /g to perform a global search
var todayStr = new Date().toISOString().substr(0,10).replace(/\x5F/g,"/");
// search string:
// change "in:inbox" to your label if you label your reminders, e. g. "in:RTMreminder"
// add " is:read " to the search string to make sure you have noticed the reminder already
var searchStr = "in:inbox before:" + todayStr + " (from:calendar-notification@google.com OR from:remind@rememberthemilk.com)";
var threads = GmailApp.search(searchStr);
for(i in threads) {
threads[i].moveToTrash();
}
} catch(e){
return true;
}
}
-- end script --
That's why I use the reminder service of RTM
( You can find a brief introduction here: https://www.rememberthemilk.com/help/guide/reminders/)
I use the email reminder to get a daily due-today-todo-list, a reminder when the task is due and a reminder 30 Minutes before it is due - just in case that I've forgot about it.
Besides my forgetfulness I am lazy and I don't delete all those reminders. I don't want to keep them either. Nothing is more worthless than old news or outdated reminders.
You cannot use the filter function in GMail because there is no way to filter for messages relatively to a specific date, e. g. before:today.
(see for instance http://productforums.google.com/forum/#!topic/gmail/GQgHrvqYMmE)
Here's a script to delete all the reminders *automatically* within Gmail.
( You can find a brief introduction about scripts in google here: https://developers.google.com/apps-script/guide
Don't worry, it's quite intuitive.
)
Just add the script and add a trigger (time driven, e. g. dayly at 1 am) to run the script.
I also clean my inbox out from old calender notifications.
If you don't like that, just delete 'from:calendar-notification@google.com' from searchStr.
btw, emails from yesterday or older are old.
-- begin script --
function CleanGmailCalRTM(){
try{
// get the date of today:
// You can modify the todayStr string to build a date for your own needs. However Gmail needs the format YYYY/MM/DD
// note: 5F is hex for "-", /g to perform a global search
var todayStr = new Date().toISOString().substr(0,10).replace(/\x5F/g,"/");
// search string:
// change "in:inbox" to your label if you label your reminders, e. g. "in:RTMreminder"
// add " is:read " to the search string to make sure you have noticed the reminder already
var searchStr = "in:inbox before:" + todayStr + " (from:calendar-notification@google.com OR from:remind@rememberthemilk.com)";
var threads = GmailApp.search(searchStr);
for(i in threads) {
threads[i].moveToTrash();
}
} catch(e){
return true;
}
}
-- end script --

techlifeweb says:
Thanks for this and a link to the scripts guide. Didn't know about Gmail scripts so this is really cool.
Log in
to post a reply.