Project:Infrastructure/Developer E-Mail/Sieve Example
From Gentoo Wiki
Jump to:navigation
Jump to:search
Incoming mails will be forwarded to sieve after creation of
| "/usr/libexec/dovecot/deliver"
Define the filter rules in
require ["fileinto", "envelope", "imap4flags", "mailbox"];
# mailbox is required to create folders if they do not exist
# refresh the folder list in your IMAP client and subscribe new folders
# Spam filter
# X-Spam-Score: 5.
# X-Spam-Level: *****
if exists "X-Spam-Flag" {
if header :contains "X-Spam-Level" "*****" {
fileinto :create "spam";
addflag "\\seen";
stop;
}
}
# bugs
if envelope :is "from" "bugzilla-daemon@gentoo.org" {
fileinto :create "INBOX.bugs";
}
# test
if header :is "subject" "test" {
fileinto :create "INBOX.test";
}
# commits
elsif header :contains "List-Id" "gentoo-commits.gentoo.org" {
#addflag "\\Seen";
fileinto :create "INBOX.list.g-commits";
}
# core ML
elsif header :contains "List-Id" "gentoo-core.gentoo.org" {
fileinto :create "INBOX.list.g-core";
}
# announce ML
elsif header :contains "List-Id" "gentoo-dev-announce.gentoo.org" {
fileinto :create "INBOX.list.g-dev-announce";
}
# catchall ML
elsif header :contains "List-Id" "gentoo.org" {
fileinto :create "INBOX.list.gentoo";
}
Test your configuration by sending a mail with the subject "test" to yourself and monitor ~/.dovecot.sieve.log
The subfolder INBOX.test will be created automatically, but you may have to subscribe it in your mail client.