The mailq
command is used to display the queue of mails that are waiting to be sent through a mail server. It can also display the status of each message in the queue, such as whether it has been sent, deferred, or has encountered an error.
Overview
To use the mailq
command, simply open a terminal window and type mailq
. This will display a list of all messages currently in the mail queue, along with their status and other information.
Here is an example output of the mailq
command:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
F0E9B12F5 1024 Mon Jul 12 09:43:21 user@example.com
(Deferred: Connection refused by example.com)
user2@example.com
F1A9B12F6 2048 Mon Jul 12 09:45:12 user3@example.com
(Deferred: Connection timed out with example.com)
user4@example.com
In this example, there are two messages in the queue. The first message has a queue ID of F0E9B12F5, a size of 1024 bytes, and was sent by user@example.com to user2@example.com. However, it has been deferred due to a connection refused error from the mail server.
The second message has a queue ID of F1A9B12F6, a size of 2048 bytes, and was sent by user3@example.com to user4@example.com. This message has also been deferred due to a connection timed out error.
Options
The mailq
command does not have any options.
Troubleshooting tips
If you encounter any issues with the mailq
command, here are some troubleshooting tips:
- If the
mailq
command does not display any messages, it means that there are no messages currently in the mail queue. - If a message in the queue has been deferred, it means that there was an issue with sending the message to the recipient. Check the error message to see if it provides any clues as to what the issue may be.
- If a message in the queue has encountered an error, it means that there was an issue with sending the message. Check the error message to see if it provides any clues as to what the issue may be.
Notes
- The
mailq
command is typically used on Linux servers that are running a mail server, such as Postfix or Sendmail. - The
mailq
command can be useful for troubleshooting mail delivery issues, as it provides information on messages that are waiting to be sent.