Excellent, Thanks Mark.
I was doing some reading on the SQL lookups and you have clarified it for me
somewhat. I'll give it a bash and let you all know how we go

Many thanks

-----Original Message-----
From: Mark Martinec [mailto:mark.martinec+ama...@ijs.si] 
Sent: Wednesday, 17 June 2009 12:54 AM
To: amavis-user@lists.sourceforge.net
Subject: Re: [AMaViS-user] local_domain_maps - MySQL Lookup

Cory,

> I have just configured my new Fedora\Postfix\Amavisd\Clam\MySQL server and
> have postfix querying MySQL for accepted relay domains(Postfix is a front
> end to other servers, Exchange etc) but haven't been able to easily find
> any documentation how to configure amavis to look at mysql for local
domain
> maps. Ideally I'd like the whole thing to be dynamic, when I add a domain
> into mysql both postfix and amavis will pick up this setting without
having
> to reload config files and or recreate has tables.

SQL lookups are dynamic. There is a field users.local ('Y'/'N' or 0/1),
which tells whether a given recipient is local or not. The recipient
(users.email) can be a domain name or an individual user, according to
the usual lookups rules (README.lookups). The SQL lookup on users.local
is implicitly prepended to the list of lookup tables @local_domains_maps.

The idea is to list all your local domains in a table 'users'.
No other fields are mandatory, in case of their absence or a
NULL value, lookups continues with statical lookup tables.
Actually even the field users.local is optional, a presence
of a matching record in table users suffices and implies
a recipient is local, unless users.email is '@.'.
See README.lookups:
  Special handling of optional SQL field 'users.local'

# list all your local domains here:
INSERT INTO users (priority,email) VALUES (5,'@example.com');
INSERT INTO users (priority,email) VALUES (5,'@example.net');
INSERT INTO users (priority,email) VALUES (5,'@example.org');
INSERT INTO users (priority,email) VALUES (5,'@localhost');

If you already have SQL schema for some other application,
one possibility is to replace the default $sql_select_policy
(actually the $sql_clause{sel_policy} ) which is:

     SELECT users.*, policy.*, users.id
      FROM users LEFT JOIN policy ON users.policy_id=policy.id
      WHERE users.email IN (%k) ORDER BY users.priority DESC

with something else, e.g. using subselects to fabricate
a table 'users'-lookalike from some other data. All that
matters is that a SELECT successfully returns a record for
local users, and does not return a record for foreign users.

Or change the other application to use amavisd SQL schema.

  Mark

----------------------------------------------------------------------------
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
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/ 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
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