Changing sender IP in Exim

June 21, 2010 • By admincPanel

One of the drawbacks of shared hosting is that you get punished without doing anything wrong. It is a common scenario that the shared hosting users often complain about blacklisting of their IP address causing the mails to be bounced.

You can change the server's IP address for sending email. Assuming you already have an IP set up on your server with a valid PTR, you can change the interface lines in your /etc/exim.conf file and restart exim:

remote_smtp:
driver = smtp
interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}

Using /etc/mailips

Create or edit /etc/mailips to map domains to their sending IPs:

example.com: 192.168.1.100
anotherdomain.com: 192.168.1.101

Restart Exim

service exim restart

For more resources on this topic, see the Zignaly Knowledge Base.