Hello,
i have few outbound transports in master.cf like this:
outbound1 unix - - n - - smtp
-o syslog_name=outbound1
-o smtp_helo_name=reverse.do.main
-o smtp_bind_address=X.X.X.X
outbound2 unix - - n - - smtp
-o syslog_name=outbound2
-o smtp_helo_name=reverse.do.main
-o smtp_bind_address=Y.Y.Y.Y
For "ordinary" users I just use sender_dependent_default_transport_maps
with SQL query that binds sender -> transport, for example:
user1@domain1 -> outbound1
user2@domain2 -> outbound2
That works as expected.
Now I have some aliases in SQL `alias` table. By default when postfix
unpacks this alias and sees external recipient it will send email
through first primary IP address of the server. No routing at all(?).
Example:
alias.address | alias.goto
+---------------|--------------------+
alias1@mydomain | recipie...@gmail.com
alias2@mydomain | recipie...@gmail.com
I want emails received:
* by alias1@mydomain and forwarded to external destination
recipie...@gmail.com to be delivered through outbound1
* by alias2@mydomain and forwarded to external destination
recipie...@gmail.com to be delivered through outbound2
I can not do "routing" based on "alias.goto" as that can be any email
address not in my control.
Now If I receive email from send...@hotmail.com to alias alias1@mydomain
and forward it to recipie...@gmail.com
sender: send...@hotmail.com
recipient: alias1@mydomain
after unpacking:
sender: send...@hotmail.com
recipient: recipie...@gmail.com
Obviously, sender_dependent_default_transport_maps won't work here.
What would be a correct solution? Should I do "SELECT CONCAT('FILTER:',
outbound_transport) FROM TABLE WHERE FIELD=ALIAS_RECIPIENT" or what?