Reputation: 449
I have a server with multiple public IP addresses. I want to send campaign emails on this server. Sometimes i would like to send mail from a particular IP (it is a filter on the sender email address that gives which IP to use). The only thing i find is to install multiple postfix instances (one per output IP). Is there a best way to do this ? I have a second question: Postfix gives a unique queue id to each message. If i have several instances of postfix, do you think thoses uniques id can be the same in 2 postfix instances ?
Thanks
Upvotes: 3
Views: 1498
Reputation: 630
sender_dependent_default_transport_maps is your friend. First, add this to main.cf
:
sender_dependent_default_transport_maps = hash:/etc/postfix/sender-transport
Next, create the file /etc/postfix/sender-transport
with
@my-sender-domain.com smtp-192-168-0-1:
Any message received with sender @my-sender-domain.com
will use the service smtp-192-168-0-1
(can be any name) for sending. Don't forget to postmap /etc/postfix/sender-transport
the file.
And then, add the service to master.cf
smtp-192-168-0-1 unix - - n - - smtp
-o smtp_bind_address=192.168.0.1
Again, the service name can be anything, but it must match the one on the hash file. This smtp
service will send the message from the IP 192.168.0.1
. Change as needed.
Add as many services and lines in the hash file as you want. Don't forget to service postfix restart
after that.
There are many other options you can add to the smtp
service, like -o smtp_helo_name=my.public.hostname.com
, etc.
I just finished to set up a postfix like this :-)
Upvotes: 0