Fredrik Elestedt said:
> I've been trying, for a couple of months, to get mail filtering to work
> in Courier - but so far I havn't managed to do it. I have three primary
> goals - listed in order:
> 1. Sorting mail by reading sorting rules from mysql
> 2. Spal-filter
> 3. Antivirus

You'll want to do these in reverse order.  Here's what I'm using:

Clamcour - http://www.becrux.com/index.php?page=projects&name=clamcour
  AV filter that uses ClamAV and rejects viruses at the SMTP level.  This
is much more efficient than waiting until after the email is accepted to
filter viruses.

SpamAssassin - http://spamassassin.apache.org
  I call SpamAssassin from the global maildrop script
(/etc/courier/maildroprc for me).  I store user prefs and bayes data in
MySQL making web based spam rules changes for end users simple (I use
the SA-SQL plugin for Squirrelmail to do it).  Here's what my maildroprc
looks like (actually, it's much more complicated but this is the
basics):

#Call SA, -u notifies spamc of what user prefs to use (since their virtual)
#-s controls the max message size SA will check
xfilter "/usr/bin/spamc -u $USER -s 300000"

#Move Spam messages to Spam folder (create folder if it doesn't exist)
if (/^X-Spam-Status: *Yes/:h)
{
  #Create SPAM IMAP folder if they don't have one
  `test -d $MAILDIR/.Spam`
  if( $RETURNCODE == 1 )
  {
    `/usr/lib/courier/bin/maildirmake -f Spam $MAILDIR`
    `echo INBOX.Spam >> $MAILDIR/courierimapsubscribed`
  }
  exception {
    to "$MAILDIR/.Spam/"
    }
}

I don't store user filters in MySQL but I may try it in the future. 
Virtual users *do not* require filters to be stored in MySQL, maildrop
will read $HOME/.mailfilter for virtual users fine, the hard part is in
securely allowing users to modify their rules.  If you do wish to store
rules in MySQL, do a search through the maildrop-list archives for some
discussions on how to do it (I believe it came up last month...

> I've got the courier mta installed on gentoo - it is working, i.e. I can
> send and recieve mail, using virtual users (hence the need to put the
> filtering in a database and not user-files).

Jay
-- 
Jay Lee
Network / Systems Administrator
Information Technology Dept.
Philadelphia Biblical University
--


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to