Exim mail general commands

 

Exim is a mail transfer agent (MTA) used on Unix-like operating systems. Exim is free software distributed under the terms of the GNU General Public License, and it aims to be a general and flexible mailer. You can easily manage exim or remove mail queues via command line.

1. To get a count of messages in the queue

# exim -bpc

1.jpg

2.Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient)

# exim -bp

 2.jpg

3. Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

# exim -bp | exiqsumm

3.jpg

 4. Print what Exim is doing right now:

# exiwhat

 4.jpg

 

Managing the queue - The main exim binary (/usr/sbin/exim) is used with various flags to make things happen to messages in the queue. Most of these require one or more message-IDs to be specified in the command line.

 5.jpg

 

5.View a message's headers:

# exim -Mvh <message-id>

6.View a message's body:

# exim -Mvb <message-id>

 7. View a message's logs:

# exim -Mvl <message-id>

 8. Remove a message from the queue:

 #exim4 -Mrm <message-id>

9.View how many frozen mails on the queue:

#exim -bpr | grep frozen | wc -l

 10. Remove all frozen messages:

# exiqgrep -z -i | xargs exim -Mrm

11.Remove all messages older than five days (86400 * 5 = 432000 seconds):

# exiqgrep -o 432000 -i | xargs exim -Mrm

 12. Freeze all queued mail from a given sender:

 # exiqgrep -i -f luser@example.tld | xargs exim -Mf