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>

Related posts:

  1. Howto change the email sending IP to an IP other than the main shared IP in exim on a cPanel server
  2. Blacklisted ? Switch your Mail Server IP
  3. Prevent your mail/IP from getting marked as SPAM/Blacklisted, A few TIPS!
  4. Postgresql issues with a cPanel server
  5. SSL Installation in a cPanel based server

Comment Form

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