Postfix: force outgoing mail for specified domain trough separate ip

To be able to send each domain mail from different ip you have to do the following:

#> vi /etc/postfix/master.cf
add postfix listener bound on alternative ip in master.cf after smtp line:

#mail.domain.com transport
domaincom_transport unix - - y - - smtp
-o smtp_bind_address=$domaincom_transport_bind_address
-o smtp_helo_name=mail.domain.com
-o syslog_name=smtp-domain

#> vi /etc/postfix/main.cf
domaincom_transport_bind_address = 192.168.0.10
#mask outgoing mails on a per domain to ip match base - add a line
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport


then create the file for mapping

#> vi /etc/postfix/sender_transport

@domain.com domaincom
@domain2.com domain2
@domain3.com domain3

save and exit and create hash db:
#> postmap hash:/etc/postfix/sender_transport

/etc/init.d/postfix restart