Search Our Database
How to Change the Outgoing IP Address for Email in cPanel/WHM
Introduction
Email delivery configuration is a critical component of server administration in environments that host multiple domains or services. In cPanel & WHM servers, the Mail Transfer Agent (MTA) responsible for handling outgoing email is Exim. By default, Exim sends outgoing email from the server’s main shared IP address. However, there are situations where administrators may need to configure specific domains to send email from different dedicated IP addresses.
Changing the outgoing IP for email is commonly required in hosting environments where multiple websites or applications operate on a single server. Different domains may require separate sending IPs to maintain proper sender reputation, isolate deliverability issues, or comply with third-party email provider requirements. For example, if one domain experiences spam complaints or blacklist issues, assigning separate outgoing IP addresses prevents other domains from being affected.
This configuration is particularly relevant for system administrators, hosting providers, DevOps engineers, and infrastructure engineers who manage cPanel servers running Exim. The process involves configuring Exim to associate specific domains with designated IP addresses using configuration files such as /etc/mailips and /etc/mailhelo.
The /etc/mailips file maps domains to the IP addresses that should be used when sending mail. Meanwhile, /etc/mailhelo defines the HELO/EHLO hostname that Exim should present when sending messages from those domains.
Prerequisites
- A server running cPanel & WHM version 94 or later
- Root SSH access to the server
- A dedicated IP address already assigned to the server
- The domain configured within the cPanel server
- Basic Linux command-line knowledge
- Access to edit configuration files such as:
- /etc/mailips
- /etc/mailhelo
Step-by-step Guide
Step 1: Connect to the Server via SSH
Access the server using SSH with root privileges.
ssh root@your-server-ip
Step 2: Verify the Dedicated IP Address
Confirm that the IP address intended for email sending is already assigned to the server.
ip addr
Alternatively, check assigned IPs through WHM:
WHM → IP Functions → Show or Delete Current IP Addresses
Ensure the IP address intended for outgoing email is listed.
Step 3: Edit the /etc/mailips File
The /etc/mailips file determines which IP address Exim uses when sending email for specific domains.
Open the file using a text editor:
vi /etc/mailips
Add a mapping between the domain and the desired sending IP:
example.com: 192.0.2.10
Explanation:
-
example.com → Domain sending the email
-
192.0.2.10 → Dedicated IP used for outgoing mail
Save the file after adding the entry.
Step 4: Configure the HELO Hostname
The /etc/mailhelo file defines the hostname that Exim announces during the SMTP HELO/EHLO handshake.
Open the file:
nano /etc/mailhelo
Add an entry for the domain:
example.com: mail.example.com
Explanation:
-
example.com → Sending domain
-
mail.example.com → Hostname used during SMTP HELO
Ensure the hostname has a valid A record pointing to the sending IP address.
Step 5: Restart the Exim Service
Restart Exim so the new configuration takes effect.
/scripts/restartsrv_exim
This reloads the mail service and activates the new outgoing IP configuration.
Step 6: Test Outgoing Email
Send a test email from the configured domain and verify the sending IP.
Use a command-line test:
exim -bt user@example.com
Alternatively, send a test message to services such as:
-
mail-tester.com
-
mxtoolbox.com
Confirm that the sending IP matches the configured IP address.
Conclusion
Configuring a custom outgoing IP address in cPanel/WHM allows administrators to control how email is routed from hosted domains. By modifying the /etc/mailips and /etc/mailhelo files, Exim can send email from dedicated IP addresses for specific domains. Proper DNS configuration such as SPF, DKIM, and PTR records should also be configured to ensure successful email delivery.
Should you have any inquiries about the guidelines, please feel free to open a ticket through your portal account or contact us at support@ipserverone.com. We’ll be happy to assist you further.