Peter,

> I have used a amavisd-maia until now and this is handled in here.
> So I have to create this. Would it be possible to extract this from
> a MySql DB. I have postfix running with a shared DB and the transport
> table contains what I have as local domains. 
> BTW the version was 2.6.4

You mean obtaining the information from an SQL database
on whether a recipient is local or not?  Yes, that is possible.

Either you provide a native schema as suggested in README.sql* files
where you list all your local domains  in table 'user', each in its own
record, or adapt the $sql_select_policy clause to match your
existing schema.

If all you need from SQL is whether a domain is local or not and are
not interested in any other SQL setting, you can use a bare-bones
schema, leaving out anything in table 'policy' and keeping
an only field 'email' in table 'users'.

Assuming you have something like:

CREATE TABLE users (email varbinary(255) NOT NULL PRIMARY KEY);
INSERT INTO users VALUES ('example.com'), ('example.org');

the following would do the job:

@lookup_sql_dsn = (['DBI:Pg:database=db_name', 'username', 'pwd']);
$sql_lookups_no_at_means_domain = 1;
$sql_select_white_black_list = undef;
$sql_select_policy = 'SELECT * FROM users WHERE email IN (%k)';


What it does: if the SELECT is able to retrieve any record given
a recipients address, that recipient is considered local.

The %k placeholder is replaced by a list of recipient's stripped-down
fields as described in SQL section of README.lookups, e.g:

  user+...@sub.example.com
  u...@sub.example.com 
  user+foo@
  user@
  sub.example.com
  .sub.example.com
  .example.com
  .com
  . 

(if subdomains should be considered too, a domain name in the
SQL table must start with a dot to be able to match the above
search list)

  Mark

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 Please visit http://www.ijs.si/software/amavisd/ regularly
 For administrativa requests please send email to rainer at openantivirus dot 
org

Reply via email to