How to check postfix mail queue in ubuntu

To check the Postfix mail queue in Ubuntu, you can use the following commands:

  1. postqueue -p: This command shows the current mail queue, including the sender, recipient, and status of each message.

    postqueue -p

    This will display a list of messages in the queue, with columns for the message ID, sender, recipient, and status.

  2. postqueue -p | less: This command is similar to the previous one, but pipes the output to the less pager, which allows you to scroll through the output and search for specific messages.

    postqueue -p | less
  3. postcat -q <queue_id>: This command shows the contents of a specific message in the queue. Replace <queue_id> with the ID of the message you want to view.

    postcat -q <queue_id>
  4. postqueue -i: This command shows the status of each message in the queue, including whether it's being held, delayed, or ready to be delivered.

    postqueue -i
  5. postqueue -s: This command shows the total number of messages in the queue, as well as the number of messages that are being held, delayed, or ready to be delivered.

    postqueue -s
  6. mailq: This command is an alias for postqueue -p and shows the current mail queue.

    mailq

    Note: The postqueue command is part of the Postfix package, so you should have it installed on your Ubuntu system. If you don't have Postfix installed, you can install it using sudo apt-get install postfix.