General Exim Commands and Info

exim -bp ⇒ show queue entries (like mailq for sendmail)
exim -bpc ⇒ no of emails currently mail queue have
exim -M email-id ⇒ Force delivery of one message
exim -qf ⇒ Force another queue run
exim -qff ⇒ Force another queue run and attempt to flush the frozen messages
exim -Mvl messageID ⇒ View the log for the message
exim -Mvb messageID ⇒ View the body of the message
exim -Mvh messageID ⇒ View the header of the message
exim -Mrm messageID ⇒ Remove message without sending any error message
exim -Mg messageID ⇒ Giveup and fail message to bounce the message to the Sender
exim -bp | exiqsumm ⇒ Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):
exim -bP ⇒ Display all of Exim’s configuration settings
exiwhat ⇒ Print what Exim is doing right now

queue is generally held in or similar  /var/spool/exim/input

!With Caution! delete entire mail queue = exim -bp | awk ‘/^ *[0-9]+[mhd]/{print “exim -Mrm ” $3}’ | sh

##Searching the queue

search the queue for messages from a specific sender:
exiqgrep -f [luser]@domain

search the queue for messages for a specific recipient/domain:
exiqgrep -r [luser]@domain

print messages older than the specified number of seconds. For example, messages older than 1 day:
exiqgrep -o 86400 […]

print messages that are younger than the specified number of seconds. For example, messages less than an hour old:
exiqgrep -y 3600 […]

##Managing the queue

Rerun (deliver) a domainnames queue
exim -q -v -R mydomainname.com

view email with messageid 1IZiOH-0007rL-KM
exim -Mvb 1IZiOH-0007rL-KM

view emails from ebay.com
exiqgrep -i -f ebay.com

Delete all emails from ebay.com
exiqgrep -i -f ebay.com | xargs -n 20 exim -Mrm

Start a queue run (redelivery):
exim -q -v

Start a queue run for just local deliveries:
exim -ql -v

Remove a message from the queue:
exim -Mrm <message-id> [ <message-id> … ]

Freeze a message:
exim -Mf <message-id> [ <message-id> … ]

Thaw a message:
exim -Mt <message-id> [ <message-id> … ]

Deliver a message, whether it’s frozen or not, whether the retry time has been reached or not:
exim -M <message-id> [ <message-id> … ]

Deliver a message, but only if the retry time has been reached:
exim -Mc <message-id> [ <message-id> … ]

Force a message to fail and bounce as “cancelled by administrator”:
exim -Mg <message-id> [ <message-id> … ]

Remove all frozen messages:
exiqgrep -z -i | xargs exim -Mrm

Remove all messages older than five days (86400 * 5 = 432000 seconds):
exiqgrep -o 432000 -i | xargs exim -Mrm

Freeze all queued mail from a given sender:
exiqgrep -i -f luser@example.tld | xargs exim -Mf

View a message’s headers:
exim -Mvh <message-id>

View a message’s body:
exim -Mvb <message-id>

View a message’s logs:
exim -Mvl <message-id>

Add a recipient to a message:
exim -Mar <message-id> <address> [ <address> … ]

Edit the sender of a message:
exim -Mes <message-id> <address>

##################################################
Run a pretend SMTP transaction from the command line, as if it were coming from the given IP address. This will display Exim’s checks, ACLs, and filters as they are applied. The message will NOT actually be delivered. start an smtp session with a server, useful for troubleshooting artemis>kelly

exim -bh 192.168.11.22
exim -d -bh 85.62.11.129
(-d is more detailed)
##################################################
Test how exim will route a given address:

root@localhost# 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
##################################################

Other tricks:

# How many Frozen mails on the queue
# exim -bpr | grep frozen | wc -l
#
# # Deleting all frozen messages
# exim -bpr | grep frozen | awk {‘print $3′} | xargs exim -Mrm
#
# # find top 20 destinations for delivery in the queue
# exim -bp | exiqsumm -c | head -n 20
#
# Q0010: Exim puts for <address> in the Received: headers of some, but not
# all, messages. Is this a bug?
#
# A0010: No. It is deliberate. Exim inserts a “for” phrase only if the
# incoming message has precisely one recipient. If there is more than one
# recipient, nothing is inserted. The reason for this is that not all
# recipients appear in the To: or Cc: headers, and it is considered a breach
# of privacy to expose such recipients to the others. A common case is when a
# message has come from a mailing list.
#
# Q0012: Exim is unable to route to any remote domains. It doesn’t seen to be
# able to access the DNS.
#
# A0012: Try running exim -d+resolver -bt <remote address>. The -d options
# turns on debugging output, and the addition of +resolver will make it show
# the resolver queries it is building and the results of its DNS queries. If
# it appears unable to contact any name servers, check the contents and
# permissions of /etc/resolv.conf.
#

You can leave a response, or trackback from your own site.

Leave a Reply