Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email firstname.lastname@example.org
From: mouss (mlist.onlyfree.fr)
Date: Thu Jun 28 2007 - 07:00:50 CDT
Simone Felici wrote:
> Hello to all!
> I've a little problem trying to configure a frontend with postfix,
> using an existing MySQL database.
> The scenario should be the following:
> By sending a mail to this server (it will be an MX), postfix must
> check if the domain is listed into the relay_domains. Until here all
> ok, it works.
> After this check, postfix should be perform another query, and here
> start my problem.
> The existing Database has a routing table. Into this table there are
> three fields:
> 1. account
> 2. domain
> 3. destination
> The account field is *not* always filled out. Sending a mail to
> "userdomain.com", if searching 'account' = 'user' AND 'domain' =
> 'domain' I obtain one result, then I've my right, destination. Buy if
> the result is empty, then I've to search ONLY the result of 'domain'
> This why there are accounts of the same domain that should be routed
> to different destinations, or domains (without accounts) that should
> be routed to other destinations too. If I could insert an "IF
> STATEMENT" this would do the trick. It's possible to point
> transport_maps to a script that perform this queries?
This should work without any IF/whatever things. postfix searches for
userdomain and then for domain. so a '%d' = domain AND '%u'= account
if not, show
- 'postconf -n' output
- postmap -q output for few entries. for instance
postmap -q fooexample.com mysql:/etc/postfix/your/transport.cf
postmap -q barexample.com mysql:/etc/postfix/your/transport.cf
postmap -q example.com mysql:/etc/postfix/your/transport.cf
where foo exists as an account, but not bar.
- logs corresponding to email sent to fooexample.com and barexample.com.