web analytics

Blog

Howto change the email sending IP to an IP other than the main shared IP in exim on a cPanel server

Tags: emailemail hostingeximip changemail hostingmail ipspam

Published on: May 22, 2009 by George K.

Howto change the email sending IP to an IP other than the main shared IP in exim on a cPanel server

Scenario:

Often it happens that a mail server’s main IP gets black listed by Yahoo, Gmail, Hotmail etc, there by causing issues to the web hosting customers in the server yelling and raising lots of support tickets. In such cases we have to change the cPanel mail server configuration.

When yahoo generates a permanently deferred message, it will take approximately 4 days or 96 hours – sometimes even a week to get it start accepting the mails from the servers. Gmail and Hotmail, simply accept the mails, but it blackholes the email , means mails will simply be deleted, without any error message from the servers.

So the solution would be to identify the spam sources and remove them. However even after we remove the spam sources, customers wont start getting emails immediately. So a temporary work around is to change the IPs from which the emails are sent out.

By default emails are sent out from a mail server using it’s main shared IP. Here we are changing it. You can change it on per-account basis or for a entire server

The easiest method to see a full version of the files with proper syntax is to temporarily enable the following “automatic” option under WHM >> Main >> Service Configuration >> Exim Configuration Editor >> Standard Options >> Domains and IPs
“Automatically send outgoing mail from the account’s IP address instead of the main IP address.”

/etc/mailips will have the following format to be followed.

domain.com: xx.xx.xx.1
sub.domain.com: xx.xx.xx.2
addondomain.com: xx.xx.xx.2
*: xx.xx.xx.xx

If you want the entire server to use an alternate IP, use the last line alone which is the wild card entry.

*: new.ip.for.smtp

Sometimes you would want to set chattr +i /etc/mailips since, a cPanel update can clear the lines in it. And once you believe the main server is unblocked, remove the chattr. Please restart the exim server as well, after you made the changes in /etc/mailips

You would need to search for

remote_smtp:
driver = smtp

and make sure that a line similar to below exists, which does literal search for the IPs in /etc/mailips. If /etc/mailips lines are not there, you can simply add interface=xx.xx.xx.xx entries.

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$

Ref : http://forums.cpanel.net/f43/formats-etc-mailhelo-mailips-etc-111977.html for more details and few more formats.

Category : cPanel, Howtos, Troubleshooting

George K.

George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items