Exim is a popular mail transfer agent (MTA) in Unix-like operating systems. Below is a comprehensive KB that covers essential commands for managing Exim on a Linux server. Whether you’re a system administrator, a web hosting professional, or a Linux enthusiast, this guide is crafted to provide you with a comprehensive set of commands to manage Exim Mail Queue.
1. Checking Exim mail Version
- Verify the installed version of Exim.
root@ervintest:~# exim -bV
Exim version 4.96.2 #2 built 16-Oct-2023 07:31:34
Copyright (c) University of Cambridge, 1995 - 2018
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2022
Berkeley DB: Berkeley DB 5.3.21: (May 11, 2012)
Support for: crypteq iconv() IPv6 PAM Perl OpenSSL TLS_resume Content_Scanning DANE DKIM DNSSEC Event I18N OCSP PIPECONNECT PRDR Queue_Ramp SPF SRS
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch passwd sqlite
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir autoreply lmtp pipe smtp
Malware: f-protd f-prot6d drweb fsecure sophie clamd avast sock cmdline
Configure owner: 0:0
Size of off_t: 8
2023-12-18 21:18:15 cwd=/home/nayana 2 args: exim -bV
Configuration file is /etc/exim.conf
2. Display the number of email messages in the exim mail queue
root@ervintest:~# exim -bpc
30
The output “30” indicates that there are currently 30 messages in the mail queue awaiting processing or delivery.
3. Display information about email messages in the queue
root@ervintest:~# exim -bp
This displays message-id, sender ,recipient, time queued and size.
4. Display a summary of messages in the exim mail queue
root@ervintest:~# exim -bp | exiqsumm
This will generate a summary report of the mail queue.
5. Display Exim’s current activity
root@ervintest:~# exiwhat
4820 daemon(4.96.2): -q1h, listening for SMTP on port 25 (IPv6 and IPv4) port 587 (IPv6 and IPv4) and for SMTPS on port 465 (IPv6 and IPv4)
The exiwhat command serves to present information about the Exim processes that are presently running. In essence, it provides insights into the current state and activity of Exim, shedding light on the daemon processes and their respective configurations.
This output indicates that Exim is currently running as a daemon, and it is configured to listen for incoming SMTP connections on both IPv6 and IPv4 addresses. Additionally, it is listening for secure SMTPS connections on port 465. The information provided by exiwhat
is useful for checking the current state and configuration of the Exim processes.
6. Displays the Header details of the particualr email
root@ervintest:~# exim -Mvh 1rFQ98-0001EF-33
The exim -Mvh
command is used to view the headers of a specific message in the Exim mail queue.
7. Displays the body of the particular email
root@ervintest:~# exim -Mvb 1VcjOL-0002YV-8g
8. To remove the mails in the queue completely
root@ervintest:~# exim -bp | awk ‘/^ *[0-9]+[mhd]/{print “exim -Mrm ” $3}’ | bash
9. View Specific Message in Queue
root@ervintest:~# exim -Mvl 1VcjOL-0002YV-8g
10. Force Delivery of Message in Queue
root@ervintest:~# exim -M 1VcjOL-0002YV-8g
11. Remove Message from Queue
root@ervintest:~# exim -Mrm 1rFQ98-0001EF-33
12. Show Exim Main Log
root@ervintest:~# cat /var/log/exim4/mainlog
13. Show Exim Reject Log
root@ervintest:~# cat /var/log/exim4/rejectlog
14. View Frozen Messages
exim -bp | grep frozen
15. Unfreeze Messages in the Queue
exim -qff