mailq(1)
Display the mail queue of pending messages waiting to be delivered.
Synopsis
mailq [-Ac] [-q[I]X] [-O QueueDir=queuedir] [-v]Description
mailq displays a summary of messages currently in the mail queue. It shows the message ID, size, arrival time, sender, and recipients for each message awaiting delivery. This is useful for monitoring mail delivery status and identifying stuck messages.
The output includes message IDs that can be used with other mail utilities like sendmail or postfix commands to take action on specific messages. On systems using Postfix, mailq is typically a symlink to postqueue.
Common options
| Flag | What it does |
|---|---|
-v | Verbose output; shows additional details about each message in the queue |
-Ac | Process all configuration files in the sendmail cf directory |
-q[I]X | Process messages in the queue; X can be G, D, L, or R for different queue groups |
-O QueueDir=queuedir | Specify an alternate queue directory to inspect |
-C configfile | Use alternate sendmail configuration file |
Examples
Display the current mail queue with message IDs, sizes, and delivery status
mailqShow only the first 20 messages in the queue
mailq | head -20Find all messages to or from [email protected] in the queue
mailq | grep [email protected]Display verbose queue information with detailed message headers
mailq -vCount the total number of messages currently in the queue
mailq | wc -lCount only actual queued messages (excluding header lines)
mailq | grep '^[A-F0-9]' | wc -l