/var/spool/exim/db/retry: unexpected file type or format

Sometimes we might face problems in receiving the emails in the inbox.While Checking the email logs we may find the error logs as follows :

/var/spool/exim/db/ratelimit: unexpected file type or format.
failed to open DB file /var/spool/exim/db/ratelimit: Bad file descriptor
H=xxx.xxxx.xxxx [1.1.1.1] temporarily rejected connection in “connect” ACL: ratelimit database not available

The above error is basically due to exim database on the server being corrupted. You can follow the steps to resolve this:

First stop the Exim service

/etc/init.d/exim stop
cd /var/spool/exim

We will create a backup of the current exim DB.

# cp -R db/ db-bak
# cd db/

After that we will remove all the files currently existing in the folder.

#  rm -rf *

Now restart the exim service so the DB is auto created.

/etc/init.d/exim start

The emails should now work fine on the server !