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 (moussnetoyen.net)
Date: Fri Aug 22 2008 - 04:38:25 CDT
Rocco Scappatura wrote:
> I would like to add further condition for delivery of email messages.
> In my main.cf I have this setting:
> virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-transport.cf
> where mysql-trasport.cf contains:
> select_field = domain
> where_field = domain
> additional_conditions = and active = 1
> I would like to do so that a message is delivered localy only if the
> 'trasport' for the domain specified by the domain part of the recipient,
> is the local server. Otherwise the message have to be forwarded to the
> responsible post office server for the recipient domain.
> So I have to add the condition:
> additional_conditions = and active = 1 and
> where 'host.domain.tld' is the name of local machine.
> Now I would like to make safer the lookup table configuration. So I have
> thought of modify the additional condition so:
> additional_conditions = and active = 1 and LOWER(transport) in
> ('smtp:`hostname -f`', 'smtp:[`hostname -i`]')
> But postfix does not interpolate the shell command..
no, postfix does not interpret shell, perl, python, php, java, ... code ;-p
> Is there a way to make safer my lookup condition?
you could try playing with
SUBSTRING_INDEX(USER(), '', -1)
but it is safer to use a script (or a makefile) to generate the .cf file
on each machine.