Skip to content

Instantly share code, notes, and snippets.

@GalaxySH
Created November 27, 2024 03:26
Show Gist options
  • Save GalaxySH/edf4238590fc7dcb2e788c71cac65bb0 to your computer and use it in GitHub Desktop.
Save GalaxySH/edf4238590fc7dcb2e788c71cac65bb0 to your computer and use it in GitHub Desktop.
address book to dummy email whitelist sieve script
# this script was written as a workaround to protonmail only permitting a few alternate emails, even on the paid plan
# the idea is to be able to have single use/compartmentalized addresses for various purposes, e.g. social media accounts
# or sketchy sites that would probably result in being added to a mailing list
# this script depends on the catch all feature for proton being turned on, allowing all emails to any address at the domains
# registered to the account to pass through and be filtered
# THIS FILTERES INCOMING MAIL BASED ON THE **TO** ADDRESS ONLY
require ["include", "environment", "variables", "relational", "comparator-i;ascii-numeric", "spamtest"];
require ["fileinto", "imap4flags", "reject", "extlists"];
# Generated: Do not run this script on spam messages
if allof (environment :matches "vnd.proton.spam-threshold" "*", spamtest :value "ge" :comparator "i;ascii-numeric" "${1}") {
return;
}
/**
* @type and
* @comparator contains
*/
if address :all :list ["To", "Cc", "Bcc"] ":addrbook:myself" {
keep;
}
elsif address :domain :is ["To", "Cc", "Bcc"] "xxx.xxx" {
# if xxx.xxx address is in whitelist address group file in inbox, otherwise put in noise folder
if address :all :list ["To", "Cc", "Bcc"] ":addrbook:personal?label=selfwl" {
fileinto "inbox";
fileinto "legit catch";
# redundant catch for dummy list but just in case the next part is ever changed
} elsif address :all :list ["To", "Cc", "Bcc"] ":addrbook:personal?label=dummyl" {
fileinto "noise";
fileinto "dummy catch";
} else {
fileinto "noise";
fileinto "dummy catch";
}
# if TO address is not a yyy.yyy address domain or is known to be myself then ignore this filter
} elsif address :domain :is ["To", "Cc", "Bcc"] "yyy.yyy" {
# check if in "selfwl" address group
if allof (address :all :list ["To", "Cc", "Bcc"] ":addrbook:personal?label=selfwl") {
fileinto "inbox";
fileinto "legit catch";
# check if in "dummyl" address group
} elsif address :all :list ["To", "Cc", "Bcc"] ":addrbook:personal?label=dummyl" {
fileinto "noise";
fileinto "dummy catch";
} else {
discard; # or
#fileinto "trash";
#reject "no";
}
# if not a personal address and not caught by filters
} else {
keep;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment