As a server administrator, you might encounter the following error when your mail server attempts to send emails to certain domains:
retry time not reached for any host after a long failure period
This issue commonly arises due to a corruption in the Exim Retry Database. When the Retry Database is corrupted, Exim (the mail server) is unable to reattempt sending emails to the affected domains, leading to this error.
What Causes This?
The Exim Retry Database is responsible for managing email retries when the initial delivery attempt fails. If the database becomes corrupt or locked, your mail server may not attempt to deliver queued emails, resulting in delayed or undelivered messages to the affected domains.
How to Fix This
To resolve the issue, you need to clear and rebuild the Exim Retry Database. Below is the procedure for fixing this on a cPanel server running CentOS or other Linux distributions.
Step 1: Clear the Corrupt Database Files
Start by removing the corrupted retry and waiting files. SSH into your server as the root user and run the following commands:
cd /var/spool/exim/db
rm -f retry retry.lockfile
rm -f wait-remote_smtp wait-remote_smtp.lockfile
These commands delete the retry
and wait-remote_smtp
files, which contain the retry records for undelivered emails. Lock files are also deleted to ensure that no processes are currently using these databases.
Step 2: Restart the Exim Service
After removing the database files, restart Exim to allow it to recreate the necessary retry files and clear the issue:
service exim restart
For systems using systemd
, you can alternatively use:
systemctl restart exim
Step 3: Clean Up the Exim Database
To ensure that old or invalid entries are cleared from the Exim database, you can use the exim_tidydb
tool to remove retry records older than one day. Run the following commands:
/usr/sbin/exim_tidydb -t 1d /var/spool/exim retry > /dev/null
/usr/sbin/exim_tidydb -t 1d /var/spool/exim reject > /dev/null
/usr/sbin/exim_tidydb -t 1d /var/spool/exim wait-remote_smtp > /dev/null
This cleans out stale records in the retry
, reject
, and wait-remote_smtp
databases that may still be causing issues.
Step 4: Update Exim and Courier Services
For an added layer of assurance, it’s advisable to force updates of Exim and Courier. This can resolve any lingering issues with the mail system:
/scripts/courierup --force
/scripts/eximup --force
These commands will recompile and update both Exim and Courier to their latest stable versions, ensuring that no underlying issues with these services are present.
Conclusion
Following these steps should resolve the “retry time not reached for any host” error by cleaning up the Exim Retry Database and allowing your server to properly attempt mail delivery again. While this error is often reported for popular domains like Gmail, it can occur with any domain if there’s an issue with the Exim database or network interruptions. If the problem persists after taking these steps, it may indicate a deeper issue such as network misconfiguration or external mail filters affecting delivery.