exim cheatsheet


Some useful cheatsheet for exim command:-

exim -Mrm <Mail ID> Remove certain email ID
exim -bp List the email queue
exim -bpc List the number of queue mail
exim -bp | exiqsumm Print summary of the mail in queue
exiwhat Print what exim is doing right now
exim -bt <[email protected]> Test how a email route from exim
exim -bP Print exim configuration
exim -qff Force delivery mail in queue
exim -M <Mail ID> Force delivery certain mail ID
exim -Mvl <Mail ID> View Email ID log
exim -Mvh <Mail ID> View Email ID header
exim -Mvb <Mail ID> View Email ID body
exiqgrep -f <[email protected]> Search certain sender from queue
exiqgrep -r <[email protected]> Search certain recipient from queue
exiqgrep -o <seconds> Search number of second(s) older than current time
exiqgrep -zi | xargs exim -Mrm Remove all frozen mail.

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.


Replace the host name and IPs with your desired information.

Exim Management

Basic command,
1. Start, stop and restart exim
/etc/init.d/exim start|stop|restart

2. Showing what exim is doing right now

3. Check how the exim route to the given email.
exim -bt [email protected]

4. Generate the exim stats from log file.
eximstats /var/log/exim_mainlog

5. Run pretend SMTP from command where xxx.xxx.xxx.xxx is the IP.
exim -bh xxx.xxx.xxx.xx

6. Display exim configuration.
exim -bP

Queue information,
1. Print the number of email queue
exim -bpc

2. Print the list of message from email queue
exim -bp

3. View the summary of message from queue.
exim -bp | exiqsumm

Searching information
1. Search the email queue from a specific sender
exim -f [email protected]

2. Search the email queue from a specific recipient
exim -r [email protected]

Lowest Numbered MX Record Points to localhost

If you are using cPanel server and you might get this error from your exim_mainlog very often whenever sending and receiving email.

temporarily rejected RCPT <[email protected]>: lowest numbered MX record points to localhost

The reason of this error message is the domain.com is missing from either the /etc/localdomains file or /etc/remotedomains file. The difference between two of these file is that, they decide whether the email has to be delivered locally or through a remote server by the exim email services.

To get it fix, add your domain.com to /etc/localdomains file to last line(new line each domain).