Proxmox Mail Gateway is a fantastic spam filtering solution. The trouble with relaying mail from a single IP address is that services like Gmail and Yahoo will quite quickly start greylisting your mail and you'll eventually end up in people's spam folders. A great solution to ensure a single IP isn't greylisted is to rotate mails through multiple IPs. This ensures that you don't end up with a single IP which is blacklisted resulting in you not being able to send out mail.
More often than not, web host admins will host people's websites and send mail from the same cPanel server. The works for a period of time until either:
- The number of users hosted on that server is large enough to send out too much mail for a single IP resulting in delays when sending mail to other mail servers.
- One of the websites or email addresses hosted on this server is compromised resulting in the server IP being blacklisted
Without too much waffling, let's get down to enabling PMG to send using multiple IPs.
Add IPs to /etc/network/interfaces
Assuming ens19 is your network interface and your public IP is 184.108.40.206 with 220.127.116.11 and 18.104.22.168 being the additional IPs you want to use to send mail, you'll end up with the interfaces file looking as follows:
iface ens19 inet static
iface ens19:1 inet static
iface ens19:2 inet static
Now, restart PMG
Create the PMG template directory and prepare config files
cp main.cf.in /etc/pmg/templates/
cp master.cf.in /etc/pmg/templates/
Next, edit the main.cf.in file:
At the bottom of this file add the following:
Next, edit the master.cf.in file:
Just after the 127.0.0.1 config, add the following:
relay1 unix - - n - - smtp
relay2 unix - - n - - smtp
relay3 unix - - n - - smtp
The important parts of the above config to take note of are the smtp_bind_address which should correspond with IPs inserted into /etc/network/interfaces as well as the smtp_helo_name which should be A-records which are created for each IP.
The final step to ensure mail servers don't reject your mail is to create an SPF record for the IP block used in the config above. In this case we would create the following SPF record:
The host can be something like:
and the value something like:
v=spf1 ip4:22.214.171.124/26 ~all
Although a Postfix restart should be fine, I would suggest rebooting PMG and then you should be good to go.