welcome: please sign in

Diff for "MemberManual/Email/EximFilter"

Differences between revisions 5 and 6
Revision 5 as of 2008-02-23 00:23:31
Size: 3350
Editor: FrankBynum
Comment:
Revision 6 as of 2008-02-23 00:25:39
Size: 3342
Editor: FrankBynum
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 8: Line 7:
Line 12: Line 10:
Line 17: Line 14:
= Putting mail into separate folders =
If you want to do anything more complicated than this, the exim project website has some good examples http://www.exim.org/exim-html-3.30/doc/html/filter_29.html. We also have an example .forward file in the following section.
Line 18: Line 17:
= Putting mail into separate folders =

If you want to do anything more complicated than this, the exim project website has some good examples [http://www.exim.org/exim-html-3.30/doc/html/filter_29.html]. We also have an example .forward file in the following section.

= Examples =
= Examples =
Line 24: Line 19:
Line 33: Line 27:
Line 35: Line 28:
Line 41: Line 33:
Line 54: Line 45:
Line 62: Line 52:
Line 66: Line 55:
Line 68: Line 56:
Line 70: Line 57:
 then save $home/Maildir/Causes.Hcoop/
        then save $home/Maildir/Causes.Hcoop/
Line 73: Line 59:
 then save $home/Maildir/Causes.Obama/
        then save $home/Maildir/Causes.Obama/
Line 76: Line 61:
 then save $home/Maildir/Causes.Flosss/

# Junk  
        then save $home/Maildir/Causes.Flosss/
# Junk
Line 81: Line 64:
 then save "/dev/null" 660
        then save "/dev/null" 660
Line 84: Line 66:
 then save $home/Maildir/.Junk.Spam/
        then save $home/Maildir/.Junk.Spam/
Line 87: Line 68:
 then save $home/Maildir/Junk.Bayes_99/
        then save $home/Maildir/Junk.Bayes_99/
Line 91: Line 71:
Line 93: Line 72:

AdamChlipala found a trick a while back that allows you to filter out bogus bounce messages. [https://lists.hcoop.net/pipermail/hcoop-discuss/2007-January/000745.html]
AdamChlipala found a trick a while back that allows you to filter out bogus bounce messages. https://lists.hcoop.net/pipermail/hcoop-discuss/2007-January/000745.html

This page explains how to use Exim's built-in per-user filtering system to sort your mail into different folders or deliver it elsewhere.

TableOfContents

Introduction

We 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.

Delivering all mail to a different address

If 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.

Putting mail into separate folders

If you want to do anything more complicated than this, the exim project website has some good examples http://www.exim.org/exim-html-3.30/doc/html/filter_29.html. We also have an example .forward file in the following section.

Examples

NathanKennedy

It 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:

# Exim filter
logfile $home/.logs/mail/spamlog
if $header_subject contains "[HCoop"
then
    save $home/Maildir/.HCoop/
    finish
endif
if
    "${if def:h_X-Spam-Level {def}{undef}}" is "def"
then
    if $h_X-Spam-Level: begins "\*\*\*\*\*\*\*\*\*"
    then save "/dev/null" 660
    else
      if $h_X-Spam-Level: begins "\*\*\*"
      then save $home/Maildir/.Junk/
      endif
    endif
    finish
endif
if
    "${if def:h_X-Spam-Flag {def}{undef}}" is "def"
then
    save $home/Maildir/.Junk/
    finish
endif

FrankBynum

#Exim filter
# Lists
if $h_to: contains "lists.hcoop.net"
        then save $home/Maildir/Causes.Hcoop/
elif $h_to: contains "groups.barackobama.com"
        then save $home/Maildir/Causes.Obama/
elif $h_X-Generated-By: CONTAINS "Launchpad"
        then save $home/Maildir/Causes.Flosss/
# Junk
elif $h_X-Spam-Level: begins "\*\*\*\*\*\*\*\*\*"
        then save "/dev/null" 660
elif $h_X-Spam-Level: begins "\*\*\*\*"
        then save $home/Maildir/.Junk.Spam/
elif $h_X-Spam-Status: contains "BAYES_99"
        then save $home/Maildir/Junk.Bayes_99/
endif

Filtering our bogus bounce messages

AdamChlipala found a trick a while back that allows you to filter out bogus bounce messages. https://lists.hcoop.net/pipermail/hcoop-discuss/2007-January/000745.html

MemberManual/Email/EximFilter (last edited 2020-09-03 21:58:33 by StephenMichel)