Skip to main content
  1. Posts/

Use a different IP for sending mail

··100 words·1 min·

If you find yourself in a pinch and you need a temporary fix when your primary IP is blacklisted, use the following iptables rule:

/sbin/iptables -t nat -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source [desired outgoing ip]

Keep in mind, however, that you will need to adjust any applicable SPF records for your domains since your e-mail will appear to be leaving via one of the secondary IP’s on your server. Also, remember that this is only a temporary fix - you should find out why you were blacklisted and eliminate that problem as soon as possible. :-)