Markus Ewald 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:Lindsay Haisley wrote:Thus spake Markus Ewald on Mon, May 22, 2006 at 02:47:11AM CDTI just switched my gentoo system from qmail to courier. Old qmail was configured to reject spam at smtp time (using simscan) and I'd like to do the same in courier. As I've found out, maildrop filters mails *after* they've been accepted, so I'll need to use Courier::Filter for that purpose.Maildrop running in embedded mode can reject mail at SMTP level, too, so messages will be rejected in the SMTP dialog. I'm not sure if this is applicable in your case. There are some restrictions on what can be done with maildrop in the embedded mode.Thanks, that really helped!I now copied /etc/maildrop to /etc/maildropfilter in ordner to run maildrop in embedded mode. As I found out, the restrictions of embedded mode can be lifted by creating a /etc/courier/maildroprcs directory and including files therein instead of directly writing the filtering instructions into /etc/courier/maildroprc.My /etc/courier/maildroprcs/spamassassin as included my /etc/courier/maildroprc contains only this line:xfilter "/usr/bin/spamc -x"
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+
spamc returns an error code if the email is identified as spam, so in my thinking, it should terminate the filter and the email should be rejected. Only what happens instead is that the smtp client is dismissed (successfully!) long before spamc finishes. This is what /var/log/mail.log says:Nothing in your filter rules told maildrop to terminate if SA was unsuccessful, plus with the -x, SA will exit with a 0 as long as spamc/spamd are working...
Documentation on this seems to be really scarce. I tried settings DEFAULTDELIVERY="| /usr/bin/maildrop -m" to enforce embedded mode but that only causes all incoming mails to be deferred. I'm really lost here.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.
Jay
begin:vcard fn:Jay Lee n:Lee;Jay org:Philadelphia Biblical University;Information Technology Department email;internet:[EMAIL PROTECTED] title:Network / Systems Administrator x-mozilla-html:FALSE version:2.1 end:vcard
