Multiple Sending IP With Postfix 3

Your single mail server only has one IP and it has started getting blocked by some of the bigger players like Yahoo, Hotmail and Gmail. You know all your email being sent is legit but it’s still being blocked. You’ve slowed the rate of your outbound messages quite a bit… but your mail queue is filling up with outbound email your customers are sending.

Here comes Postfix version 3 to the rescue. In version 3 it introduced a new randmap table which made this much easier to send using a random IP.

In /etc/postfix/, just add the following lines:

sender_dependent_default_transport_maps = 

Those lines have 2 effects:

  • Randomly select an SMTP client for sending each email.
  • Prevent the SMTP clients from caching connections, so sending multiple emails to a single domain does not end up using the same SMTP client.

In /etc/postfix/, just add new SMTP services and configure them to bind the designated IPs

relay1     unix  -       -       n       -       -       smtp
  -o smtp_bind_address6=IP6
  -o smtp_bind_address=IP1
  -o syslog_name=relay1
relay2     unix  -       -       n       -       -       smtp
  -o smtp_bind_address=IP2
  -o smtp_bind_address6=IP6
  -o syslog_name=relay2
relay3     unix  -       -       n       -       -       smtp
  -o smtp_bind_address=IP3
  -o smtp_bind_address6=IP6
  -o syslog_name=relay3
relay4     unix  -       -       n       -       -       smtp
  -o smtp_bind_address=IP4
  -o smtp_bind_address6=IP6
  -o syslog_name=relay4

This is easy to update and will allow outbound emails to use the same IP addresses less and distribute the reputation across your network. You might find it hard to get more than one IPv4 address assigned by your virtual server provider but for those with extra floating around in a pool. This is the perfect solution.


Leave a Reply

Your email address will not be published. Required fields are marked *