Gary wrote:

> Rocco wrote:

>>> One possibility (depending on your setup). Create a policy
>>> where every configuration setting is NULL with the exception 
>>> of spam_lover and bypass_spam_checks (you need to set both 
>>> when bypassing). Something like this:

>> My setup is Amavisd-new+Postfix+MySQL

Actually, I was referring to whether you were already using a
@example.com type of user.

I wrote this in an old post. The concept you need to understand is how
the 'priority' field affects what settings are used. This may help a little:

###############################################################
The purpose of the policy_id field will be apparent when we add some data to the
policy table, but what is the 'priority' field used for? If you were to read
README.lookups, you would see that recipient lookups in hash tables
are performed starting with the most specific data (the full email address)
and end with the most general data (a catchall). Here is the example of the 
order
of lookups performed when using a hash table:

[EMAIL PROTECTED]
[EMAIL PROTECTED]
user+foo@
user@
sub.example.com
.sub.example.com
.example.com
.com
.

For SQL, the structure of what is looked up is a little different, but we still
want the lookups performed in the same 'specific' to 'general' order, for 
example:

[EMAIL PROTECTED]
[EMAIL PROTECTED]
user+foo
user
@example.com
@.example.com
@.com
@.

The key is that the SQL SELECT statement used in the program uses the priority 
field
to create this order (in descending order):

>From the amavisd source code:
# The SQL select clause to fetch per-recipient policy settings
# The %k will be replaced by a comma-separated list of query addresses
# (e.g. full address, domain only, catchall).  Use ORDER if there
# is a chance that multiple records will match - the first match wins
# If field names are not unique (e.g. 'id'), the later field overwrites the
# earlier in a hash returned by lookup, which is why we use '*,users.id'.
$sql_select_policy =
  'SELECT *,users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id'.
  ' WHERE users.email IN (%k) ORDER BY users.priority DESC';

So, given a recipient address of '[EMAIL PROTECTED]', the SQL SELECT statement \
that determines the policy for a given recipient would end up looking like this:

SELECT *,users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id 
 WHERE users.email IN ("[EMAIL PROTECTED]", "[EMAIL PROTECTED]",
 "user4+spam", "user4", "@example.com", "@.example.com", "@.com", "@.")
  ORDER BY users.priority DESC;

###################################################################

Gary V



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to