Managing Exim via the command line is straightforward. You can handle mail queues, identify and remove accounts that send large volumes of emails, and more.
All sent emails are logged in the directory /var/spool/exim/msglog, with each record assigned a unique ID that matches the message ID. In /var/spool/exim/input, messages are labeled with -H (header) and -D (message content) after their ID. Exim creates three files for each sent message, and we will focus on these directories.
Commands for Managing Mail Queues
1. Count messages in the queue:

2. List messages in the queue (including time queued, size, message ID, sender, recipient):

3. Summarize messages in the queue (count, volume, oldest, newest, domain, totals):

4. Show current Exim activity:

5. Test email address resolution:

6. Simulate an SMTP transaction from a given IP (does not deliver the message):

7. Display Exim configuration settings:

Searching the Queue with exiqgrep
exiqgrep is a useful tool for searching through the queue.
1. Search for messages from a specific sender:
exiqgrep -f [@domain](https://buycheapvps.com/)
Search for messages to a specific recipient/domain:
exiqgrep -r [@domain](https://buycheapvps.com/)
3. Print messages older than a specified number of seconds (e.g., older than 1 day):

4. Print messages newer than a specified number of seconds (e.g., less than an hour old):

5. Match messages by size with a regex (e.g., 700-799 bytes):

6. Print just the message IDs from a search:

7. Count messages matching a search:

8. Print all message IDs in the queue:

Managing the Queue
1. Start a queue run:

2. Start a queue run for local deliveries only:

3. Remove a message from the queue:

4. Freeze a message:

5. Throw away a message:

6. Deliver a message, regardless of its frozen status or retry time:

7. Deliver a message only if the retry time has been reached:

8. Force a message to fail and bounce as "cancelled by administrator":

9. Remove all frozen messages:

10. Remove all messages older than five days (432000 seconds):

11. Freeze all queued mail from a specific sender:

12. View a message's headers:

13. View a message's headers:

14. View a message's logs:

Analyzing Exim Mail Logs with exigrep
To handle log entries that span multiple lines, exigrep helps gather all related entries into complete transactions.
1. Search for messages sent from a particular IP address:

2. Search for messages sent to a particular IP address:

3. Generate and display Exim stats from a log file:

4. Display less verbose stats:

5. Delete all queued messages containing a specific string in the body:

For more detailed documentation, you can visit Exim's official site and Exim's documentation.