MemberManual/Email/EximFilter252020-09-03 21:58:33StephenMichelRemove excessive admonition box242020-09-03 21:57:29StephenMichelReorganize in order of usefulness232020-08-09 21:59:54StephenMichelAdded Sieve filter example222019-02-02 03:42:48BjörnLindström212019-02-02 03:42:22BjörnLindström202019-02-02 03:42:01BjörnLindströmAdded my .forward for some more complicated examples using 'matches' regexps.192016-04-24 03:23:52StephenMicheloops, syntax182016-04-24 03:13:21StephenMichelBetter solution172016-04-24 02:35:53c-71-192-154-186.hsd1.ma.comcast.netAdded a new template162013-01-14 09:10:39ClintonEbadicat / needs work152013-01-08 20:33:20ClintonEbadiupdate link to documentation isn't hopelessly obsolete142008-07-07 04:28:16localhostconverted to 1.6 markup132008-04-24 17:51:29NathanKennedy122008-04-22 03:37:37MichaelOlsonExplain credentials112008-04-15 01:45:28AdamChlipalaKerberos principals?102008-02-23 01:09:11cpe-76-172-126-78.socal.res.rr.com92008-02-23 00:45:38cpe-76-172-126-78.socal.res.rr.com82008-02-23 00:32:46FrankBynum72008-02-23 00:26:25FrankBynum62008-02-23 00:25:39FrankBynum52008-02-23 00:23:31FrankBynum42008-02-22 23:52:31FrankBynum32008-02-22 23:51:47FrankBynumOld ac.uk page does not exist anymore! Found a substitute.22007-12-05 09:42:1466-234-51-139.nyc.cable.nyct.netFirst line of exim filters MUST be "# Exim filter"12007-11-01 21:44:45MichaelOlsonInitial contentsThis page explains how to use Exim's built-in per-user filtering system to sort your mail into different folders or deliver it elsewhere. IntroductionWe use Exim as our mail daemon. It has a built-in filtering system that allows people to write a ".forward file" to give it custom instructions. Normally this is stored at ~/.forward
, but at HCoop we store it at ~/.public/.forward
to make it easier to keep the rest of your home directory private. So when we say ".forward" on the rest of this page, we mean ~/.public/.forward
. When email is delivered, the delivery process will run as the USER.daemon
user, where USER
is your HCoop username. Delivering all mail to a different addressIf you want email sent to your HCoop email address to be forwarded elsewhere, you can do that as follows. Make a .public/.forward
file in your home directory. It should contain only one line, consisting of just the e-mail address to which mail should be forwarded. (This is a standard UNIX .forward
file.) Putting mail into separate foldersFor anything more complicated, you have two options: sieve and exim filters. In StephenMichel's opinion, sieve filters have the saner syntax, although exim filters are slightly more powerful. To use them, start your .public/.forward
file with one of these special lines for identifying the type of filter: # Exim filter
# Sieve filter
The line above is not an ordinary comment. Any other values will cause Exim to attempt to treat the file as a list of forward addresses instead of a filter file. Create folders before adding rules for them. Exim is not able to create new folders, only sort mail into existing ones. You should create and subscribe to any folders mentioned in these filters from within your IMAP client before adding them to your filter. Sieve Filter ExamplesStephenMichelLessons learned the hard way If your script has a syntax error, and parsing reaches that point in the script, mail will simply not be delivered. Always send yourself a test email after making changes. Probably due to our AFS setup, the only filing syntax that seems to work is fileinto, using an absolute path. keep does not work, including automatic/implicit keep, so you must explicitly fileinto your inbox. If you just want quick examples, use the section below, fastmail's guide, or ProtonMail's guide. However, if you want to actually understand what you're doing & what's possible, all the various articles out there really suck; fortunately (and surprisingly) rfc 5228 itself is relatively light reading and you'll save yourself a lot of time starting there instead of searching for a more "consumer-facing" explanation. This is my current filter, with two changes: Removed rules that were identical in syntax, just with different values Changed all domains to example.com
, to prevent spambots picking up anyone's email address off this page. Exim Filter ExamplesThe exim project website has some good examples . We also have example .public.forward
files in the following section. NathanKennedyIt is possible to set up custom filters to do fancy things based on the X-Spam-Level: header. Here is NathanKennedy's ~/.public/.forward
file. He finds that the default setting of 5.0 is too wimpy, and lets too much spam into his inbox. Virtually no ham that he gets scores less than 3.0, whereas a lot of spam scores less than 5.0, so he'd rather have anything over 3.0 go to his Junk folder. At the same time, he doesn't want to waste time, cycles, disk space or bandwidth with spam over 9.0. Most of his spam does score 9.0, and this goes straight to /dev/null (immediately disposed of) with this filter. Finally, he has all HCoop list email go into a special HCoop folder. Without further ado: StephenMichelThis template filters anything sent to me@example.com
or to me+$anything@example.com
into the sub-folder me
. This is useful if you have one or more aliases set up, to filter mail for each alias into its own subfolder. Björn LindströmSome rules using matches
which allows PCRE style regular expressions. Filtering out bogus bounce messagesAdamChlipala found a trick a while back that allows you to filter out bogus bounce messages. CategoryMemberManual CategoryNeedsWork