Re: [exim] Still Trying to Figure Out Spam Settings..

Top Page
Delete this message
Reply to this message
Author: Mike Cardwell
Date:  
To: exim-users
New-Topics: Re: [exim] *Suspect* Re: Still Trying to Figure Out Spam Settings..
Subject: Re: [exim] Still Trying to Figure Out Spam Settings..
On 21/10/2010 23:49, Brian Spraker wrote:

> I posted a bit back about trying to figure out how I can allow users to modify
> their own spam settings.
>
> A database is setup with three fields - 'spam_enable', 'spam_flag', and
> 'spam_delete'.
>
> under acl_check_rcpt, this has been added - and it does work appropriately
> (because this occurs with each "rcpt to" command and can reject recipients):
>
> accept
> condition = ${if eq{${lookup mysql{SELECT spam_enable FROM users WHERE
> account="${local_part}@${domain}"}}}{N}}
>
> The above condition checks to see if the user has the 'spam_enable' feature set
> to "N" for No. If so, then it will accept the mail and skip checking blacklists
> and such.
>
> The same line was added into the acl_check_data area.
>
> However, as another newsgroup member posted, the ${local_part} and ${domain} do
> not work here - because the possibility of having multiple recipients.
>
> This is also causing a snag in the same area (acl_check_data) where I'm not able
> to pull the spam_flag and spam_delete values. The spam_flag item is the
> user-set threshold that will just flag the e-mail as spam in the subject line.
> The spam_delete item is the user-set threshold that will delete the mail.
>
> So, I basically am wondering if there is some kind of way - like a while loop -
> that will go through each of the recipients and check these three things in the
> acl_check_data routine.
>
> I'm quite lost with trying to figure out some kind of solution for this. The
> Exim config file isn't like scripting PHP or anything like that :)
>
> Thank you for any advice!


In your DATA acl, you can either accept for all recipients, or reject
for all recipients. You can't accept/reject on a per recipient basis.
This is a very common problem, and is a limitation of SMTP it's self
rather than any sort of limitation in Exim.

The simplest method is to just only allow emails to have one recipient,
by defering subsequent recipients in the rcpt acl. Then use $recipients
in the DATA acl. I believe there might be cases were broken mail servers
don't like this behaviour though.

If you're going to allow multiple recipients, there are two possibilities:

1.) All recipients have the same spam filtering requirements
2.) Some of the recipients have differing filtering requirements

If (1) happens, then you just store this information in the rcpt acl,
and then re-use it in the data acl. If (2) happens, you have to decide
how you're going to treat that case and then use that information in the
data acl.

There's another option but it's not great. If 1 or more of the
recipients don't want spam filtering, but 1 or more do. Then do the spam
filtering, but don't reject in the DATA acl. Just record whether or not
the message is spam. Then in the routers, check if the message was
marked as spam, and if so, let it through for the non-spam-filtering
users, and blackhole or bounce it for the rest. Bouncing will get you
added to blacklists for generating backscatter. Blackholing is bad
behaviour because neither the sender nor the recipient is informed of
the message delivery failure.

It's not simple.

-- 
Mike Cardwell - Perl/Java/Web developer, Linux admin, Email admin
Read my tech Blog -              https://secure.grepular.com/
Follow me on Twitter -           http://twitter.com/mickeyc
Hire me - http://cardwellit.com/ http://uk.linkedin.com/in/mikecardwell