I have on one server domain1.com domain2.com domain3.com on CentOS and Qmail. I want them to send email trough a second server that uses ip1, ip2, ip3. I can easy do this by editing this Qmail file:
and I add the IPs there, but I have no idea how I could set it to so that each domain sends trough its own IP. Is there a syntax in smtproutes file? e.g [if @domain1.com then use this IP]. OR Is there a way to redirect this on the second server by some mail filtering or firewall? So that a mail that comes from domain1.com will be send from ip1.com, domain2.com from ip2, etc.
Second server has Sendmail and I see it has some advanced features, I am not sure what to use, most of the relay options seem to help to redirect depending on receiver domain rather than sender domain (what I need).
// I am using the second server because main server has some filtering from provider anyway, but even when sending directly from main server, you cannot seem to be able to specify what IP to use when sending mail, qmail just uses default server IP in that case.