Situation:
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.
Solution:
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/main.cf, just add the following lines:
sender_dependent_default_transport_maps = randmap:{relay1,relay2,relay3,relay4} smtp_connection_cache_on_demand=no
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/master.cf, 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 smtp_helo_name=foo1.bar.com -o syslog_name=relay1 relay2 unix - - n - - smtp -o smtp_bind_address=IP2 -o smtp_bind_address6=IP6 -o smtp_helo_name=foo2.bar.com -o syslog_name=relay2 relay3 unix - - n - - smtp -o smtp_bind_address=IP3 -o smtp_bind_address6=IP6 -o smtp_helo_name=foo3.bar.com -o syslog_name=relay3 relay4 unix - - n - - smtp -o smtp_bind_address=IP4 -o smtp_bind_address6=IP6 -o smtp_helo_name=foo4.bar.com -o syslog_name=relay4
Summary:
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.