$linuxjunkies
>

mailq(1)

Display the mail queue of pending messages waiting to be delivered.

UbuntuDebianFedoraArch

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

FlagWhat it does
-vVerbose output; shows additional details about each message in the queue
-AcProcess all configuration files in the sendmail cf directory
-q[I]XProcess messages in the queue; X can be G, D, L, or R for different queue groups
-O QueueDir=queuedirSpecify an alternate queue directory to inspect
-C configfileUse alternate sendmail configuration file

Examples

Display the current mail queue with message IDs, sizes, and delivery status

mailq

Show only the first 20 messages in the queue

mailq | head -20

Find all messages to or from [email protected] in the queue

mailq | grep [email protected]

Display verbose queue information with detailed message headers

mailq -v

Count the total number of messages currently in the queue

mailq | wc -l

Count only actual queued messages (excluding header lines)

mailq | grep '^[A-F0-9]' | wc -l

Related commands