Blacklisted ? Switch your Mail Server IP

Hello,

I’m pretty sure that many of us are tired of the word ‘Spam’. How about your mails being rejected from your domain when sending to Top level E-mail providers like GMail, Yahoo and MSN Hotmail ? It may be a familiar weird issue to many of you. This post is about how to tackle those situations. But if you are an End-user, please contact your System Admin. But if you are the one by that name, read on !

Case

The E-mails being rejected to the Top level providers since your server IP is blacklisted. You can check whether your server IP is blacklisted at : http://www.mxtoolbox.com/blacklists.aspx (Read xxx.xxx.xxx.xx as your server IP)

When the IP is entered and you click ‘Blacklist Check’, the resultant screen should be expected as (Assuming your server IP is on a blacklist)

There you go, your server IP is blacklisted, only thing that varies is the number of blacklists. So, what is the solution ? Most will be preferring to provide a dedicated IP to the domain which is having the issue. But when a whole Server IP is blacklisted, this will not work. But as usual, there is nothing new under the Sun !!

Solution

Switch the Mail server IP of the Server.

Work

Find a free IP, make sure its allocated to  the server, or else add it to the server. That is upto you. After this, there are a few steps, which is just a Walk in the Park :)

1) Access the WHM of the Server, as root. Go to Exim Configuration Editor. Find out the Category Domains and IPs, and enable this option :

Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)

Save the Changes.

2) Login to server through SSH, Switch to root

root@server[~]# vi /etc/mailips

Add this line
* : xxx.xxx.xxx.xx (Your Mail server IP)

So the following should be seen when reading the content in /etc/mailips

root@server[~]# cat /etc/mailips
*: xxx.xxx.xxx.xx

3) Add a Reverse DNS entry for the IP, you may need to contact DC for this. When you are finished this do the steps :

root@server[~]# vi /etc/mail_reverse_dns

Add this line
xxx.xxx.xxx.xx: hostname

4) Change File attributes of /etc/mailips

root@server[~]# chattr +i /etc/mailips
root@server[~]# lsattr /etc/mailips
----i-------- /etc/mailips

5) Final Steps : Build Exim Config file to reflect changes, Restart Exim Service

root@server[~]# /scripts/buildeximconf
root@server[~]# service exim restart

Case is Resolved ! Now you must be able to send E-mails everywhere. Try it.

Continue Reading

Exim cheat sheet – Commands for troubleshoot mail issues in cPanel/DirectAdmin or any exim mail server

Below are the most common exim commands which helps an Administrator to ease his life

Print a count of the messages in the queue:

exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

exim -bp

Print a summary of messages in the queue (count, volume, oldest, newest, domain, and total

exim -bp| exiqsumm

Print what Exim is doing right now:

exiwhat

To check if the server routes the mail properly use exim -bt

# exim -bt alias@localdomain.com
user@thishost.com
    <-- alias@localdomain.com
  router = localuser, transport = local_delivery
root@localhost# exim -bt user@thishost.com
user@thishost.com
  router = localuser, transport = local_delivery
root@localhost# exim -bt user@remotehost.com
  router = lookuphost, transport = remote_smtp
  host mail.remotehost.com [1.2.3.4] MX=0

Display all of Exim’s configuration settings:

exim -bp

exiqgrep

Its used for grepping through the  exim queue.

search the queue for messages from a specific sender :

exigrep -f  user@domainname.com

Search the queue for a specific reciepient

exigrep -r user@domainname.com

To print messages older than the specified number of seconds use -o .

For example, messages older than 1 day:

exigrep -o 86400

To print messages younger than specified number of seconds use -y

Messages younger than one day can be listed  using the command

exigrep -y 86400

Print just the message-id of the entire queue:

exiqgrep -i

Managing the queue

Start a queue run:

exim -q -v

Start a queue run for just local deliveries:

exim -ql  -v

Remove a message from the queue:

exim -Mrm <message id >

Freeze a message:

exim -Mf <message id >

Thaw a message:

exim -Mt <message id>

Deliver a message, whether it’s frozen or not, whether the retry time has been reached or not:

exim -M <message id>

Deliver a message, but only if the retry time has been reached:

exim -Mc <message_id>

Force a message to  Freeze and bounce as “Canceled by Admin”

exim -Mg <message id>

Remove all frozen mails

exigrep -z -i | xargs exim -Mrm

Remove all messages older than five days (86400 * 5 = 432000 seconds):

exigrep -o 432000 -i | xargs exim -Mrm

Freeze all queued mail from a given sender

exiqgrep -i -f user@domain.com | xargs exim -Mf

View a message’s headers:

exim -Mvh <messageid>

View a message’s body:

exim -Mvb <message id>

View a message’s logs:

exim -Mvl <message id>

Continue Reading


 

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later