{"id":65,"date":"2026-08-30T09:20:00","date_gmt":"2026-08-30T06:20:00","guid":{"rendered":"https:\/\/fsaeed.blog\/?p=65"},"modified":"2026-10-31T00:18:50","modified_gmt":"2026-10-30T21:18:50","slug":"sieve-filters-noisy-inbox","status":"publish","type":"post","link":"https:\/\/fsaeed.blog\/index.php\/2026\/08\/30\/sieve-filters-noisy-inbox\/","title":{"rendered":"Sieve Filters: Taming a Noisy Inbox on the Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello, tech enthusiasts! \ud83d\udc4b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You open your inbox on Monday morning and see 140 new emails. Most of them are system notifications: &#8220;Your report is ready&#8221;, &#8220;New login&#8221;, &#8220;Weekly summary&#8221;. Somewhere in the middle are the three emails from real people that actually need you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rules in a desktop email app only run when that app is open, so your phone still shows all 140 emails. There is a better way: <strong>Sieve<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What you need<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An email account on a server that supports Sieve (many do, especially servers that use Dovecot)<\/li>\n\n\n<li>Access to your webmail, for example Roundcube or SOGo, or a server admin who can add a script for you<\/li>\n\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Understand what Sieve is<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sieve is a small language for email rules. It runs <strong>on the mail server<\/strong>, at the moment a message arrives. Think of it like a mail room worker who sorts the letters before they go into your box. Your laptop can be off, and the sorting still happens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the sorting happens on the server, the folders look the same everywhere: on your laptop, on your phone, and in webmail. \ud83d\udcf1<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Find where to add your rules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In most webmail apps, look in <strong>Settings<\/strong>, then <strong>Filters<\/strong> (or &#8220;Rules&#8221;). Many have a simple form and an option to edit the filter set as raw text. We will write raw text, because you can copy it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your company runs its own mail server, the admin can also add a script for your mailbox.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: The first lines<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every Sieve script starts by saying which extra features it needs. This is the <code>require<\/code> line.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>fileinto<\/code> lets you move a message into a folder.<\/li>\n\n\n<li><code>imap4flags<\/code> lets you set flags, like &#8220;read&#8221;.<\/li>\n\n\n<li><code>mailbox<\/code> lets the script create a folder if it does not exist yet.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>require [\"fileinto\", \"imap4flags\", \"mailbox\"];<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Write the rules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rules run from top to bottom. The command <code>stop<\/code> means &#8220;this message is done, do not check more rules&#8221;. Here is a full example. Change the addresses to your own.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>require [\"fileinto\", \"imap4flags\", \"mailbox\"];\n\n# Rule 1: mail from my own team always stays in the inbox\nif address :domain :is \"from\" \"example.com\" {\n    keep;\n    stop;\n}\n\n# Rule 2: automatic notifications go to a folder, already marked as read\nif address :localpart :is \"from\" [\"noreply\", \"no-reply\", \"notifications\"] {\n    fileinto :create \"Notifications\";\n    addflag \"\\\\Seen\";\n    stop;\n}\n\n# Rule 3: daily reports go to their own folder (unread, so you notice them)\nif header :contains \"subject\" [\"Daily report\", \"Weekly summary\"] {\n    fileinto :create \"Reports\";\n    stop;\n}\n\n# Rule 4: mailing lists go to a folder\nif exists \"list-id\" {\n    fileinto :create \"Lists\";\n    stop;\n}\n\n# Rule 5: mail not sent to me directly (for example, to a group address)\nif not address :is [\"to\", \"cc\"] \"me@example.com\" {\n    fileinto :create \"Group Mail\";\n    stop;\n}\n\n# Everything else stays in the inbox\nkeep;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Two kinds of tests are used:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>address<\/strong> tests look at an email address in a header. You can check the whole address (<code>:is<\/code>), only the part after the @ (<code>:domain<\/code>), or only the part before it (<code>:localpart<\/code>).<\/li>\n\n\n<li><strong>header<\/strong> tests look at any header as text. <code>:contains<\/code> means &#8220;has this text somewhere inside&#8221;.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Notice <code>\"\\\\Seen\"<\/code>. The flag is really <code>\\Seen<\/code>, but in Sieve text the backslash must be written twice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rule 5 is the &#8220;keep mail addressed to you&#8221; rule. If your address is in To or Cc, the message stays. If you got it through a group address, it moves away.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Test safely<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A wrong rule can hide important emails. So be careful:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Never use <code>discard<\/code> or <code>reject<\/code> while testing.<\/strong> Always use <code>fileinto<\/code>. A message in a folder can be found again. A discarded message is gone.<\/li>\n\n\n<li><strong>Add one rule at a time.<\/strong> Send yourself a test email after each one and check where it lands.<\/li>\n\n\n<li><strong>Check the folders daily<\/strong> in the first week.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">On the server, Dovecot includes <code>sieve-test<\/code>. It shows what a script would do with a saved email, without delivering anything:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sieve-test my-rules.sieve test-message.eml<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Common problems<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The script is rejected with an error about <code>:create<\/code>.<\/strong> Your server does not support the <code>mailbox<\/code> extension. Remove <code>\"mailbox\"<\/code> and <code>:create<\/code>, and create the folders by hand first.<\/li>\n\n\n<li><strong>Mail goes to a strange folder like &#8220;INBOX.Reports&#8221;.<\/strong> Some servers need the full folder path. Check how your folders are named in webmail and use the same name.<\/li>\n\n\n<li><strong>A rule never matches.<\/strong> Many systems send notifications from addresses like <code>alerts@mail.example.net<\/code>. Open the email, view the original headers, and copy the exact address.<\/li>\n\n\n<li><strong>Nothing happens at all.<\/strong> Make sure the filter set is <strong>active<\/strong>. Many webmail apps let you keep several sets but only one is active.<\/li>\n\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Wrap-up<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With five rules, your inbox shows only the emails from people who need you. Notifications wait quietly in their folder, on every device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next idea: add a rule that flags emails with words like &#8220;urgent&#8221; or &#8220;invoice&#8221; from your important contacts, using <code>addflag \"\\\\Flagged\"<\/code>, so they stand out with a star.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use Sieve rules on your mail server to sort email into folders before it reaches your phone.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,15,25,66],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-automation","tag-email","tag-productivity","tag-sieve"],"_links":{"self":[{"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":1,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fsaeed.blog\/index.php\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}