Markdown
# Sieve Information for server-side mail filtering ## Online Resources These are some useful resources for managing Sieve scripts for mail filtering (such as with Dovecot Sieve, or CMUSieve) * http://wiki.fastmail.fm/index.php?title=BasicSieve * http://wiki.fastmail.fm/index.php?title=SieveExamples ## Examples ### Upload/activate script on remote server To upload a Sieve script to a managesieve server, you can use any compatible client. Here's an example of uploading and then activating a script using the [sieve-connect](http://people.spodhuis.org/phil.pennock/software/) program from Phil Pennock: ``` sieve-connect -s mail.domain.tld -u user@domain.tld --localsieve foobar.sieve --remotesieve foobar --upload sieve-connect -s mail.domain.tld -u user@domain.tld --remotesieve foobar --activate ``` ### craSH's example sieve script This is a simple sieve that filters spam (based on dspam) and the Neg9 Hackers mailing list into their own directories. ```aconf require ["fileinto", "reject"]; # Spam if header :contains ["X-DSPAM-Result"] "Spam" { fileinto "Spam"; stop; } # Neg9 hackers elsif header :is "List-Id" "Neg9 Hackers <hackers.neg9.org>" { fileinto "lists/neg9-hackers"; stop; } ``` ### kaizoku's example sieve script ```aconf require ["fileinto"]; if header :is "X-DSPAM-Result" "Spam" { fileinto "spam"; stop; } elsif header :matches ["List-Id", "X-List-Id", "Mailing-List", "X-Mailing-List", "X-Loop"] "*" { fileinto "lists"; stop; } elsif header :matches "From" ["*@flickr.com*", "*mixi*", "Facebook*", "Twitter*"] { fileinto "sites"; stop; } ``` ---- CategoryInfrastructure
Preview