mailq Command
Purpose
Prints the contents of the mail queue.
Syntax
/usr/sbin/mailq [ -v ]
Description
The mailq and MAILQ commands print a list of messages that are
in the mail queue. The first line printed for each message shows:
- The internal identifier used on this host for the message with a possible status character
- The size of the message in bytes
- The date and time the message is accepted into the queue
- the envelope sender of the message
Note: Starting from AIX® 7 with 7200-04,
the non-root users must run the mailq -Ac command instead of the mailq command to view
the messages in the mail queue.
The second line shows the error message that caused the message to be retained in the in the queue, it is not displayed if the message is being displayed for the first time. The status characters are either:
- *
- Indicates the job is being processed
- X
- Indicates that the load is too high to process the job
- -
- Indicates that the job is too young to process
The following lines show message recipients, one per line.
The mailq command is the same as the sendmail -bp command.
Specify the -v flag to display message priority.
Flags
Item | Description |
---|---|
-v | Prints verbose information. This adds the priority of the message and a single character indicator (+ or blank) indicating wheather a warning message has been sent on the first line of the message. Additionally, extra lines may be intermixed with the recipents indicating the controlling user information; this shows who owns any program that are executed on behalf of this message and the name of the alias this command expanded from, if any. |
-Ac | Prints the list of messages that are queued in the /var/spool/clientmqueue directory. |
Exit Status
The command returns the following exit values:
Item | Description |
---|---|
0 | Exits successfully. |
>0 | An error occurred. |
Examples
The mailq command prints two types of lists:
- The mailq command lists the mail queue as shown in the
following example:
Mail Queue (1 request) ---QID---- --Size-- -----Q-Time----- ------Sender/Recipient----- AA02508 3 Thu Dec 17 10:01 root (User unknown) bad_user
- The mailq -v command lists the mail queue as follows:
Mail Queue (1 request) ---QID---- --Size-- -Priority- ---Q-Time--- --Sender/Recipient-- AA02508 3 1005 Dec 17 10:01 root (User unknown) bad_user
- The mailq -Ac command lists the
clientmqueue
mail queue as follows:/var/spool/clientmqueue (1 request) -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- 00FGNTRH12845482 5 Wed Jan 15 10:23 root (Deferred: Connection refused by [127.0.0.1]) unknown-user Total requests: 1
The fields have the following meanings:
Item | Description |
---|---|
QID | Contains the message queue ID of the message. |
Size | Contains the number of bytes in the body of the message (heading information not included). |
Priority | Contains the priority of the message, based primarily on the size of the message. |
Q-Time | Contains the time the message entered the queue. |
Sender/Recipient | Contains the user ID of the sender and the recipient of the message. A message on the line between the sender and the recipient indicates the status of the message. |
Files
Item | Description |
---|---|
/usr/sbin/mailq | Contains the mailq command. |
/var/spool/mqueue directory | Contains the log file and temporary files associated with the messages in the mail queue. |
/var/spool/clientmqueue | Contains the messages that are in mail queue for non-root users. |