exiqgrep
Search Exim queue messages
TLDR
Match the sender address using a case-insensitive search
Match the sender address and display message IDs only
Match the [r]ecipient address
Remove all messages matching the sender address from the queue
Test for bounced messages
Display the [c]ount of bounced messages
SYNOPSIS
exiqgrep [options] [pattern]
PARAMETERS
-o timespec
List messages older than the specified time. Examples: '1h' (1 hour), '1d' (1 day), '2w' (2 weeks).
-y timespec
List messages younger than the specified time.
-s size_spec
List messages with a size matching the specification. Can use operators like '>' or '<'. Example: '>1M' (larger than 1MB).
-f pattern
Filter messages where the sender matches the given regular expression pattern.
-r pattern
Filter messages where any recipient matches the given regular expression pattern.
-t pattern
Filter messages where the subject line matches the given regular expression pattern.
-i pattern
Filter messages where the message ID matches the given regular expression pattern.
-z
List only frozen messages (messages that are currently not being retried).
-x
List only non-frozen messages (messages actively being retried).
-c
Instead of listing messages, output a count of matching messages.
-l
List detailed information for each message, similar to exim -bpl
output.
-b
Produce brief output, showing only the message ID.
-h
Display sizes and times in human-readable format (e.g., '1M', '1h').
-a
List all messages in the queue (often used in conjunction with other filters).
[pattern]
A general regular expression pattern to match against default fields (typically sender, recipient, or message ID if not specified by other options).
DESCRIPTION
exiqgrep is a specialized utility designed to list and filter messages within the Exim Mail Transfer Agent (MTA) queue. It acts as a convenient wrapper around Exim's internal queue listing command (e.g., exim -bpl
or exim -bp
) and pipes its output through a powerful filtering mechanism, similar to the grep command.
System administrators commonly use exiqgrep to quickly identify, inspect, and manage messages in the Exim queue. It allows for filtering by various criteria such as sender, recipient, subject, message ID, age, size, and frozen status. This makes it invaluable for troubleshooting mail delivery issues, identifying spam, or monitoring queue health without having to parse the raw Exim queue output directly. It provides a user-friendly and efficient way to query specific queue entries.
CAVEATS
exiqgrep relies on parsing the output of exim -bpl
. Future changes to Exim's queue listing format could potentially break exiqgrep's functionality.
It typically requires root privileges or to be run as the Exim user to access the mail queue and list messages properly. For very large queues, iterating and filtering can be resource-intensive, though it's generally efficient for most administrative tasks.
COMMON USAGE SCENARIOS
- Find messages from a specific sender:
exiqgrep -f 'bad_spammer@example.com'
- List all frozen messages:
exiqgrep -z -l
- Count messages older than 2 days:
exiqgrep -o 2d -c
- View messages to a specific recipient:
exiqgrep -r 'user@destination.com'
- Delete found messages (requires root and care):
exiqgrep -i '^
(Use with extreme caution!)' | xargs exim -Mrm
HISTORY
exiqgrep is distributed as part of the Exim Mail Transfer Agent's suite of utilities. Its development paralleled the growth and widespread adoption of Exim, providing system administrators with a dedicated and powerful tool for managing and troubleshooting the Exim mail queue, simplifying tasks that would otherwise require complex scripting around the raw exim -bpl
output.