cPanel: Change the outbound email IP in Exim

If your cPanel server is a shared environment server, your server IP might be blocked by any RBL list such as SpamHaus.

As cPanel by default set the primary email as the SMTP mail IP, to enable different IPs to be send from the cPanel, you may follow the step as below,

1. Log into WHM.
2. Select Service Configuration and choose Exim Configuration Editor.
3. Find “Reference /etc/mailips for outgoing SMTP connections” and enable it.
4. Edit the file named /etc/mailips through SSH.

example.com: 192.168.0.2
sub.example.com: 192.168.0.2
example.net: 192.168.0.3
addon.example.net: 192.168.0.3
*: 192.168.0.1

Replace the host name and IPs with your desired information.

How to check DNSBL automatically?

PEAR::Net_DNSBL provides an easy way to check if a given Host or URL is listed on an DNS-based Blackhole List (DNSBL, Real-time Blackhole List or RBL) or Spam URI Realtime Blocklist (SURBL).

According to PEAR::Net_DNSBL manual, you may trigger PEAR::Net_DNSBL automatically to check certain IPs that needed.

First of all, you will need to install PEAR::Net_DNSBL as command below,
pear install NET_DNSBL

By referring to the sample script from PEAR::Net_DNSBL manual, I have modified the script to be able to send an email to me when found any IPs range that needed by me as below,

Continue reading How to check DNSBL automatically?