Jeff Potter wrote:
I'd like to run spamc inside a courier filter, and if the score is too
high, reject the message at the smtp layer. (That's not crazy.) The
"problem" with this is that some users invariably do not want their
messages filtered, while others do -- or more precisely, different users
have different thresholds for message rejection. Since it's only
possible to reject or accept the message for all recipients, such a
filter seems unattainable.
Nothing's entirely unattainable. You've got at least three options:
1: Reject messages that are spam by any of its recipients' definition.
It's possible that very few legitimate messages will end up blocked, and
users will be able to live with this. You could also restrict SMTP
blocking to messages that meet specific tests like BAYES_90 or BAYES_99,
or any of the SURBL tests (I think I've got that acronym right).
2: Accept messages if any recipient would accept them. This is probably
more acceptable to users. You'll accept a few more messages, but the
users whose own configuration files will mark the messages as spam will
still filter the messages away.
3: Accept messages if any recipient would accept them, and modify the
control file so that users who would not accept the message are marked
delivered, and don't get the message at all. You can do this with the
last courier-pythonfilter package I released.
What issues are there with writing a filter that looks at *all* of the
recipients, finds the *highest* threshold (lower being more
restrictive), and uses that? (Extend to include blacklists and
whitelists...)
Aside from the issues you've already thought through, just that at this
time, you'll have to process the message twice as often, but only for
mail you accept. You'll process it during the SMTP session and either
accept or reject the message, then you'll end up throwing away the
results of the scan until the message is delivered to users, and
maildrop can scan it again.