{"id":8230,"date":"2026-05-12T09:55:00","date_gmt":"2026-05-12T07:55:00","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=8230"},"modified":"2026-06-09T07:27:10","modified_gmt":"2026-06-09T05:27:10","slug":"overview-of-sieve-filter-rules","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/","title":{"rendered":"Overview of Sieve Filter Rules"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">Sieve is a mail filtering language used by email servers to automatically process incoming messages. It allows users to create rules that sort, move, forward, reject, or delete emails based on specific conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using Sieve filters, you can automate mailbox management and reduce the time spent organizing messages manually.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Basic_Elements_of_a_Sieve_Script\" >Basic Elements of a Sieve Script<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Comments\" >Comments<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Required_Extensions\" >Required Extensions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Conditions\" >Conditions<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Common_Sieve_Conditions\" >Common Sieve Conditions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#header\" >header<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#address\" >address<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#size\" >size<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#body\" >body<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Common_Sieve_Actions\" >Common Sieve Actions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#fileinto\" >fileinto<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#redirect\" >redirect<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#discard\" >discard<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#keep\" >keep<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#reject\" >reject<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Example_Sieve_Script\" >Example Sieve Script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Practical_Uses_for_Sieve_Filters\" >Practical Uses for Sieve Filters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/overview-of-sieve-filter-rules\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Basic_Elements_of_a_Sieve_Script\"><\/span>Basic Elements of a Sieve Script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Comments\"><\/span>Comments<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<\/div>\n\n<div id=\"mybox-1688409677\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Comments are ignored by the Sieve interpreter and are useful for documenting your rules.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># This is a comment\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Required_Extensions\"><\/span>Required Extensions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most Sieve scripts begin by declaring the extensions that will be used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>require &#91;\"fileinto\", \"reject\"];\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These extensions enable additional actions such as moving messages to folders or rejecting messages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conditions\"><\/span>Conditions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Conditions determine when a specific action should be performed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if header :contains \"Subject\" \"important\" {\n    # actions\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the rule checks whether the email subject contains the word &#8220;important&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_Sieve_Conditions\"><\/span>Common Sieve Conditions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"header\"><\/span>header<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Checks the value of specific email headers.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if header :contains \"From\" \"example@example.com\" {\n    # actions\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This rule examines the sender address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"address\"><\/span>address<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Checks email addresses found in message headers.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if address :domain :is \"From\" \"example.com\" {\n    # actions\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This example matches any sender from the example.com domain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"size\"><\/span>size<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Filters messages based on their size.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if size :over 500K {\n    # actions\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This condition matches messages larger than 500 KB.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"body\"><\/span>body<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Checks the content of the email body.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if body :contains \"unsubscribe\" {\n    # actions\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This rule triggers when the specified text appears within the message content.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_Sieve_Actions\"><\/span>Common Sieve Actions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"fileinto\"><\/span>fileinto<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Moves a message to a selected mailbox folder.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if header :contains \"Subject\" \"project\" {\n    fileinto \"Projects\";\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Messages matching the condition will be moved to the &#8220;Projects&#8221; folder.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect\"><\/span>redirect<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Automatically forwards a message to another email address.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if address :is \"To\" \"old@example.com\" {\n    redirect \"new@example.com\";\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"discard\"><\/span>discard<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Silently deletes a message without notifying the sender.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if header :contains \"Subject\" \"spam\" {\n    discard;\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"keep\"><\/span>keep<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Leaves the message in the Inbox.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if header :contains \"Subject\" \"important\" {\n    keep;\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"reject\"><\/span>reject<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rejects the message and returns an error notification to the sender.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if size :over 10M {\n    reject \"Message too large\";\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_Sieve_Script\"><\/span>Example Sieve Script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The following example demonstrates several common filtering actions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>require &#91;\"fileinto\", \"reject\"];\n\n# Move project-related emails\nif header :contains \"Subject\" \"project\" {\n    fileinto \"Projects\";\n}\n\n# Forward messages from a specific sender\nif address :is \"From\" \"boss@example.com\" {\n    redirect \"manager@example.com\";\n}\n\n# Reject oversized messages\nif size :over 10M {\n    reject \"Message too large\";\n}\n\n# Remove unwanted messages\nif header :contains \"Subject\" \"spam\" {\n    discard;\n}\n\n# Keep all remaining messages\nkeep;\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_Uses_for_Sieve_Filters\"><\/span>Practical Uses for Sieve Filters<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sieve can be used to automate many common email management tasks, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Sorting invoices into a dedicated folder<\/li>\n\n\n\n<li>Separating work and personal emails<\/li>\n\n\n\n<li>Automatically forwarding messages to another address<\/li>\n\n\n\n<li>Blocking unwanted senders<\/li>\n\n\n\n<li>Filtering newsletters and mailing lists<\/li>\n\n\n\n<li>Rejecting oversized attachments<\/li>\n\n\n\n<li>Organizing support requests into specific mailboxes<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Sieve provides a powerful and flexible way to automate email management directly on the mail server. By combining conditions and actions, you can create advanced filtering rules that keep your mailbox organized and ensure important messages are handled exactly as intended.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether you want to sort incoming mail, block unwanted messages, or automate forwarding, Sieve offers a reliable server-side solution that continues to work even when your email client is offline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[28],"manual_kb_tag":[1289,1956,7593,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027],"class_list":["post-8230","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-others","manual_kb_tag-mail-filtering","manual_kb_tag-email-filters","manual_kb_tag-email-automation","manual_kb_tag-sieve","manual_kb_tag-sieve-filters","manual_kb_tag-sieve-scripting","manual_kb_tag-sieve-script-examples","manual_kb_tag-sieve-extensions","manual_kb_tag-sieve-conditions","manual_kb_tag-sieve-actions","manual_kb_tag-sieve-script","manual_kb_tag-sieve-language","manual_kb_tag-email-servers","manual_kb_tag-server-side-filtering","manual_kb_tag-server-side-email-filtering"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/8230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":2,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/8230\/revisions"}],"predecessor-version":[{"id":8231,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/8230\/revisions\/8231"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=8230"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=8230"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=8230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}