Hi everyone long time didn't check into English site
If anyone have problem with spam folder getting a lot of inappropriate emails
Like i use to get
someone on the Yiddish site created a script what will Permanently delete your spam folder every N minutes
Just follow these staps
function DeleteByLabel() {
var label = "spam";
var threads = GmailApp.search("in:" + label);
var me = Session.getActiveUser().getEmail();
Logger.log("Found " + threads.length + " threads with label " + label);
for (var i = threads.length - 1; i >= 0; i--) {
var thisid = threads[i].getId();
Logger.log(
"Removing thread " +
i +
" of " +
threads.length +
" from " +
label +
" with ID = " +
thisid
);
try {
Gmail.Users.Threads.remove(me, thisid);
} catch (err) {
Logger.log(
"Error " + err.message + " when removing thread with ID " + thisid
);
}
}
}
- Click on top where it says Untitled project
- Give the script a name
- Save (ctrl+s)
- Click the Run Icon
- a authorization box wil pop up
- click review permissions
- Choose the correct account
- click advanced
- Click go to {your project name} (unsafe)
- Click Allow
- Check if no errors popping up
- Press ctrl+enter
- see if there’s any error
- it will say Error “Gmail” is not defined
- go to https://cloud.google.com/
- click on console (top right)
- Click select a project
- Create new project
- Give it a name (Delete Spam)
- Create
- Go to API’s and Services
- Go to Library
- Search “Gmail”
- click on Gmail API
- Click Enable
- you can close this tab
- on the scrips tab
- click the + next to services
- Look for Gmail API
- select it
- press add
- Click run
- Check your Spam folder
- Now lets turn on a timer to run the script every N minuts
- click on the clock icon
- it will take you to the triggers page
- Click Add Trigger (bottom right)
- choose whatever minute interval you want (not every minute)
- click save
All Done! - הד''א Credit: Wannabe
drive.google.com/file/d/1oUzcizmoG_l6rhBh5TRk2kF4DfvEoyaF/view?usp=sharing