Am 26.10.2011 13:42, schrieb Robert Schetterer:
> Hi,
> i have a feature request
> i need to have transport choosing by mailbox/emailaddress ( just like in
> the domain table )
>
> Background there are different type of users/emailaddresses
> there are virtual ones ( mail going in server mailbox via dovecot lmtp),
> others
> are on different places on exchange servers ( mails to them should smtp
> transported to the exchange ip )
> this works without problems with i.e. a postfix transport hash table,
> mysql should work too, but we need it ,for supporters in the
> postfixadmin gui
> If Donation is needed/wanted please write what will it take to hack this
as nobody answered
i changed the alias goto sql query
to use it for seperate user/mailaddress smtp transports
perhaps other likes it too
mysql_virtual_alias_maps.cf
...
query = SELECT goto FROM alias WHERE goto NOT REGEXP
'somenot.exist.servernamein.dns' AND address='%s' AND active = 1;
mysql_virtual_transport_maps.cf
...
query = SELECT CONCAT('smtp:[', SUBSTRING_INDEX (goto,'@', 1),']') FROM
alias WHERE goto REGEXP 'somenot.exist.servernamein.dns' AND
address='%s' AND active = 1;
main.cf
...
transport_maps = hash:/etc/postfix/transport,
mysql:/etc/postfix/mysql_virtual_transport_maps.cf
...
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
...
so you may use now
ip....@so...rvernamein.dns
in the alias field of a mailbox
this produces a transport like
em...@ad...ss smtp:[ip.ad.dr.ess]
and disables all other alias (gotos) for this mailbox !
it only works for mailbox aliases ( not pure aliases ) !
somenot.exist.servernamein.dns
is free to choose, but it must pass postfixadmins syntax check
and should not exist in dns, anyway its just somkind of "marker" in this
context, it should not be the real dns servername
of your postfix box, cause this "may" produce conflicts with your local
postfix transport
you should not use it if you have
relay_domains = mysql:/etc/postfix/mysql_relay_domains_maps.cf
in your postfix setup
by getting warnings in postfix logs
be warned, this workaround may conflict with other stuff at your
postfix(admin)setup
test it hardly before use in production
--
Best Regards
MfG Robert Schetterer
Germany/Munich/Bavaria
|