Skip to content

Instantly share code, notes, and snippets.

Last active November 9, 2023 19:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Automatically delete fake phishing emails from IT
function filter_emails() {
/// 1day is the smallest increment
var threads ="newer_than:1d in:inbox");
for (var i = 0; i < threads.length; i++) {
// get all messages in a given thread
var messages = threads[i].getMessages();
for (var j = 0; j < messages.length; j++) {
var body = messages[j].getRawContent();
// Possible headers to filter
// X-PHISH: This is a security awareness phishing simulation test from InfoSec Institute that has been authorized by the recipient organization
// X-Report-Abuse-To:
if (body.indexOf("X-PHISH-CRID") > -1) {
* Go to
* Add new project
* Add the above code
* Click save icon
* Go to Triggers
* Add new trigger
* Everything is gravy
* /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment