Skip to content

Instantly share code, notes, and snippets.

@richstokes
Created August 31, 2025 15:14
Show Gist options
  • Select an option

  • Save richstokes/500b2ae03cb636a6de7f51d26525b195 to your computer and use it in GitHub Desktop.

Select an option

Save richstokes/500b2ae03cb636a6de7f51d26525b195 to your computer and use it in GitHub Desktop.
Filter all terms and conditions / privacy policy type emails in protonmail
require ["include", "environment", "variables", "relational", "comparator-i;ascii-numeric", "spamtest"];
require ["fileinto", "imap4flags"];
# Skip anything scored as spam by Proton
if allof (environment :matches "vnd.proton.spam-threshold" "*",
spamtest :value "ge" :comparator "i;ascii-numeric" "${1}") {
return;
}
# Match change-related verbs/phrases
# AND legal/terms nouns/phrases in the Subject
if allof (
anyof (
header :comparator "i;unicode-casemap" :contains "Subject"
["update", "updates", "updated", "updating",
"change", "changes", "changed", "changing",
"amend", "amended", "amendment", "amending",
"modify", "modified", "modification", "modifications",
"revise", "revised", "revision", "revisions",
"we've updated", "we have updated",
"effective", "effective as of",
"notice of changes", "policy update", "terms update",
"action required"]
),
anyof (
header :comparator "i;unicode-casemap" :contains "Subject"
["terms", "terms of service", "terms & conditions", "terms and conditions",
"t&cs", "t and cs", "tos",
"user agreement", "customer agreement", "service terms",
"master service agreement", "msa",
"acceptable use policy", "aup",
"privacy policy", "cookie policy",
"data processing", "data processing addendum", "dpa",
"eula", "license agreement", "billing terms"]
)
) {
fileinto "T&Cs";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment