[NOTICE] New account registration is currently closed. Existing members are unaffected.
itpromail
home / docs / filtering

Sieve examples: seven ready-to-use rules

These are complete rule snippets you can paste into a script in Account > Filters. Each one lists the extensions it needs in its require line. If you combine several in one script, merge the lists into a single require line at the top. Adjust folder names, addresses and header values to match your mail, and create the folders before you activate the script.

1. File list mail into a folder

require ["fileinto"];

if header :contains "List-Id" "announce.example.org" {
    fileinto "Lists";
}

2. File mail from a specific sender

require ["fileinto"];

if address :is "from" "billing@example.net" {
    fileinto "Invoices";
}

3. Discard mail marked as spam by a header

Check the raw headers of a spam message you received before you write this rule, and match only the header your spam filter actually sets. This example uses X-Spam-Flag, a common convention. discard drops the message without notice to you or the sender, so while you test, replace it with fileinto "Junk"; and switch over once you are satisfied.

if header :is "X-Spam-Flag" "YES" {
    discard;
}

4. Route plus addresses

ITProMail supports plus addressing, so mail sent to you+shop@itpromail.com reaches your mailbox. The subaddress extension lets a rule test the tag after the plus sign.

require ["fileinto", "subaddress"];

if address :detail "to" "shop" {
    fileinto "Shopping";
}

5. File large messages

require ["fileinto"];

if size :over 25M {
    fileinto "Large";
}

Messages can be up to 50 MB, so a 25 MB threshold is a practical point to review them. Filing does not reduce storage use, because the messages still count toward your quota. See storage quotas.

6. Automatic reply while away

require ["vacation"];

vacation :days 1 :subject "Out of office" :addresses ["you@example.org", "you@example.com"]
  "I am away and will reply when I return.";

The :days value sets how often the same sender receives a reply, and 1 is the minimum. :addresses lists your own addresses so replies are only sent for mail addressed to you. Keep the text short and avoid putting personal details in it. Vacation implementations generally do not answer bulk or list mail, but check with a test.

7. File a group of messages, then stop

require ["fileinto"];

if anyof (header :contains "Subject" "[ticket]", header :contains "Subject" "[incident]") {
    fileinto "Tickets";
    stop;
}

stop ends processing for the message, so rules below this one do not run for it. Place it after any rule that should still see these messages.

Test each rule

Send one test message that should match and one that should not. Confirm the target folder and the header value in the raw message. When the rules behave as expected, remove any temporary test folders and actions.