Awesome Sieve Filters

A repo of useful sieve filters by the community. This is mainly aimed at ProtonMail filters, but they should work with any sieve filter interpreter. See here for the Proton sieve filter docs.



AnonDaddy specific sender

This example is using Anonaddy alias forwarding, but the field in the header can be adjusted to be SimpleLogin or even the base Proton header fields. Placing Seen first ensures it works. If you use the expire command seen will not work unless it is first - confirmed by Proton mods. Expire will delete email after stated days.

require ["imap4flags", "fileinto", "vnd.proton.expire"];

if  header :matches "X-Anonaddy-Original-Sender" ["SENDER@EMAIL.com"]{ 
	addflag "\\Seen"; 
    fileinto "FOLDERNAME";
	expire "day" "3";
}

File by contact group name

If the email comes from an address listed in the a contact group. You need to create a contact group for every folder you have.

require ["extlists", "fileinto"];

if header :list "from" ":addrbook:personal?label=CONTACTGROUPNAME" 
{
  fileinto "FOLDERNAME";
  fileinto "LABEL";
}

File by recipient

File into specific folder for a chosen recipient email address.

require ["fileinto", "comparator-i;ascii-numeric"];

if allof (address :all :comparator "i;unicode-casemap" :is ["To", "Cc", "Bcc"] "NAME@YOUREMAIL.COM") {
    fileinto "FOLDERNAME";
}

File all sent emails

This prevents your sent emails showing up in other folders. Create an addressbook called "myself" and input all your email addresses.

require ["include", "fileinto", "extlists"];

if header :list "from" ":addrbook:myself"
{
  fileinto "sent";
  return;
}

File unkown senders

If the email address isn't in any contact groups, move it into a folder named SCREENER

require ["extlists", "fileinto"];

if not header :list "from" ":addrbook:personal?label=*" 
{
  fileinto "Screener";
  stop;
}

File By Mailing List

If the email comes from a valid account in address group, but also is a mailing list

require ["extlists", "fileinto", "vnd.proton.expire"];

If  allof (
    exists "List-Unsubscribe",
    header :list "from" ":addrbook:personal?label=GROUPNAME" 
) { 
    addflag "\\Seen";
    fileinto "FOLDERNAME";
    expire "day" "3";
}

SimpleLogin Labels

This filter automatically sets label for emails sent to SimpleLogin aliases. For example, any email sent to alias paypal.XXXX@slmail.me will be labeled as Paypal.

require ["include", "environment", "variables", "relational", "comparator-i;ascii-numeric", "spamtest", "fileinto"];

if allof (address :all :comparator "i;unicode-casemap" :matches "From" "*simplelogin.co",
address :all :matches "To" "*.*@*") # The "To" address condition is used to get the first part (before the dot)
{
	set :lower :upperfirst "labelvar" "${1}"; # ${1} contains the part before the dot, then we capitalize the first letter
  	fileinto "${labelvar}"; # Apply the label
}