Jay Lee wrote:
I'm not sure -x is the command line option you want, the error codes returned with -x are based on errors between spamc/spamd not based on the spam status of the incoming message. Take off the -x and try checking the headers instead:

xfilter "/usr/bin/spamc"
if (^X-Spam-Status: *Yes/)
{
 echo "Message rejected as spam"
 EXITCODE=1
 exit
}

This will reject all message SA thinks are spam, you might wish to instead look for a certain spam score with:

if (/^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*/:h)

which will reject messages with a SA score of 10+
Okay, fixed that.

maildrop is getting called twice for you, once during the SMTP session just after the message is received and before Courier responds with a 2xx (message accepted) or 5xx (message rejected) code. All you can do here is accept or reject a message. Later, during local delivery (long after the SMTP session has ended and Courier has fully accepted the message from the remote server). Maildrop is running again in order to deliver the message to a mailbox. This 2nd time is where you can modify headers or move the message to another user, etc.

In can see the line "message rejected as spam" in my log, but courier is still accepting mails with a SMTP 2xx result and then delivery fails with "status: deferred". I tried it using the maildroprcs folder and also by creating a .mailfilter in my user's home directory, but both methods produce the above result.

If I change DEFAULTDELIVERY to "| /usr/bin/maildrop -m", the 'xfilter' line in my user's .mailfilter produces a syntax error, which leads me to the conclusion that my maildrop is not being run in embedded mode after all. Strange.

I created /etc/courier/maildropfilter just like the documentation says:

     maildropfilter
This file contains one line whose contents is a pathname to the maildrop(1) mail delivery filter. In addition to being a delivery agent, maildrop can also be used as a mail filtering engine. If this file exists, Courier will be capable of invoking recipient- specified mail filters when a message is received. If the mail fil- tering rules reject the message, Courier will not accept the mes- sage for delivery. This means that when receiving mail via ESMTP, Courier will reject the ESMTP transaction without even accepting
            the message from the remote mail server.

This file is not installed by default. To activate mail filtering for local recipients, simply copy the contents of the maildrop con-
            figuration file to maildropfilter.

Jay

-Markus-




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to