Pablo, > I am sending mail from [EMAIL PROTECTED] to [EMAIL PROTECTED] > in my mailaddr table I have: > [EMAIL PROTECTED] id = 1 > [EMAIL PROTECTED] id = 7
Ok. > In my msgs table I have: > all messages from [EMAIL PROTECTED] sid = 91159 > all messages from [EMAIL PROTECTED] sid = 84333 This is irrelevant, tables msgs, msgrcpt, maddr only serve for logging to SQL, and are mostly independent from the lookup set of table: users, policy, mailaddr and wblist. > Logs shown that [EMAIL PROTECTED] return 17 as result of the sql query.. I > coundn't find this record in the database, or any other file. How does this > is working? 17 is the users.id, i.e. a record in table 'users' most closely describing that recipient, either its exact address, or a domain, or some catchall record. The lookup that lead to this entry was the $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 Each users.id then can have its own set of records in table wblist. The join is on wblist.rid=users.id, in this case the 17. Find the matching record in 'users' for "[EMAIL PROTECTED]": > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup_sql_field(id) > "[EMAIL PROTECTED]" result=17 resulting in users.id=17 > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup, 1 matches for > "[EMAIL PROTECTED]", results: "/cached/"=>"17" > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) wbl: (SQL) recip > <[EMAIL PROTECTED]>, 1 matches Now prepare for finding sender in tables: > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) > lookup_acl([EMAIL PROTECTED]) matches key ".example.org", result=1 > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup (local_domains) > => true, "[EMAIL PROTECTED]" matches, result="1", > matching_key=".example.org" Sender belongs to local_domains (only affects preparing the following set of search keys). > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) query_keys: > [EMAIL PROTECTED], mail, @example.org, @.example.org, @.com, @. Here is our lookup into table wblist, with its arguments. The wblist.rid must be 17. > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup_sql > "[EMAIL PROTECTED]", query args: "17", "[EMAIL PROTECTED]", "mail", > "@example.org", "@.example.org", "@.com", "@." > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup_sql select: > SELECT wb FROM wblist LEFT JOIN mailaddr ON wblist.sid=mailaddr.id WHERE > (wblist.rid=?) AND (mailaddr.email IN (?,?,?,?,?,?)) ORDER BY > mailaddr.priority DESC > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) sql begin, > nontransaction > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) sql: executing clause: > SELECT wb FROM wblist LEFT JOIN mailaddr ON wblist.sid=mailaddr.id WHERE > (wblist.rid=?) AND (mailaddr.email IN (?,?,?,?,?,?)) ORDER BY > mailaddr.priority DESC but nothing was found, probably because recipuent 17 does not have any w/b list entries in wblist: > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup_sql, > "[EMAIL PROTECTED]" no match > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup_sql_field(wb), > "[EMAIL PROTECTED]" no matching records > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup => undef, > "[EMAIL PROTECTED]" does not match > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) wbl: (SQL) recip > <[EMAIL PROTECTED]>, rid=17, got: "" > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup > (blacklist_recip<[EMAIL PROTECTED]>) => undef, "[EMAIL PROTECTED]" does not > match Since SQL didn't find anything, proceed with static lookups: > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) query_keys: > [EMAIL PROTECTED], mail@, example.org, .example.org, .com, . > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) > lookup_hash([EMAIL PROTECTED]), no matches > Nov 12 18:25:58 postfix amavis[7110]: (07110-01-70) lookup > (blacklist_sender) => undef, "[EMAIL PROTECTED]" does not match etc. > In my wblist table I have: > rid = 91159 | sid = 1 | wb = W Probably not what you want. Keep in mind the SELECT on wblist: $sql_select_white_black_list = 'SELECT wb FROM wblist LEFT JOIN mailaddr ON wblist.sid=mailaddr.id'. ' WHERE (wblist.rid=?) AND (mailaddr.email IN (%k))'. ' ORDER BY mailaddr.priority DESC'; The wblist.rid joins with users.id, the wblist.sid joins with sender id at mailaddr.id. See the example in README.sql. Mark ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ AMaViS-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/
