Thanks a lot for your post. I found a few improvements in case someone else is interested. :)
const clientGmail = 'your email@gmail.com'
const page = { q: "in:trash from: abusers_email@whatever.com", pageToken: null, }
const limit = 5400000;
function deleteFromTrash() { const threadList = Gmail.Users.Threads.list('me', page); var x= threadList.resultSizeEstimate if(x!=0){ threadList.threads.forEach(threadss => {
const id = threadss.id const threadByOtherAPI = GmailApp.getThreadById(id) const threadDate = threadByOtherAPI.getLastMessageDate() const timeNow = new Date const period = timeNow - threadDate const recent = period < limit if (recent) { Gmail.Users.Threads.remove(clientGmail, id); } })
} }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks a lot for your post. I found a few improvements in case someone else is interested. :)
const clientGmail = 'your email@gmail.com'
const page = {
q: "in:trash from: abusers_email@whatever.com",
pageToken: null,
}
const limit = 5400000;
function deleteFromTrash() {
const threadList = Gmail.Users.Threads.list('me', page);
var x= threadList.resultSizeEstimate
if(x!=0){
threadList.threads.forEach(threadss => {
}
}