I have a postfix mail server with a working opendkim and SPF setup. Everything works when I use only 1 IP/MX/hostname (e.g. mail.example.com). I try to enable another IP so the postfix could balance traffic when sending bulk emails (e.g. mail2.example.com).
At first I planed to use iptables
for rotating IPs but I noticed that my emails will probably be soon marked as spam
because the received email does not always have the IP and the hostname properly set. The next solution was multi-instances
but I noticed that this will only separate mail features not actually make duplicated instances. So I decided to manage the logic my self and just use multiple hostnames/IPs on the mail server side.
The problem that I'm facing is that postfix always sends an email using the primary IP address. How can I configure the postfix to send email over the same IP address that the message is received? So e.g. if I telnet mail.example.com 25
and send an email, the email is sent using the mail.example.com
hostname & IP and if I telnet mail2.example.com 25
and send an email, the email is sent using the mail2.example.com
hostname & IP.
I've search the web but I can't find the right answer. How people usually solve this? Thx!
I think that the configuration that suits your needs is described in the URL below. It describes using one server for inbound mail and another for outbound mail (on the same machine) but you can use the same guide to setup two outbound servers.
http://linuxpoison.blogspot.co.uk/2008/02/howto-make-two-instance-of-postfix.html
If each instance is bound to its own IP that may achieve what you need.