Guides and tutorials

Hundreds of tutorials and step by step guides carefully written by our support team.

How to check the mail queue of a Linux server in SW Hosting

Sometimes we may find that our mail server is generating a high message queue. In these cases, it is advisable to check the behavior of the mail server to make sure that everything is working correctly.

CRITICAL: postfix mail is 203 (threshold c =200)

How to check if the services are active

The first thing we should check is that all the services related to the mail server are working correctly. To do this we must go to our SWPanel account and, using the top search engine, access the dashboard of our mail server:

Subsequently, through the "Services status" section, we can see the status of all the mail server's services:

How to check the mail server queue

If all the services are active, we will have to check what is the reason why the mails are being stored in the server queue and are not reaching their destination.

For it, we will connect by SSH to the mail server. In the following Manual you will be able to see how to connect to the console of your server by means of SWPanel.

Once in the server's console, we will use the following command to check the server's queue:

mailq

This command will show us the mail messages that are in the queue with the following format.

Each mail message will be displayed with the following parts:

  1. Identifier: This code uniquely identifies each message on the server. An identifier can only identify one message from the same server.
  2. Source account: This is the account that has sent the message (If the source account is MAILER-DAEMON the message has been sent by the mail server itself).
  3. Destination account: This is the account to which the mail message is addressed.
  4. Error message: This message informs us, briefly, of the reason why our mail message could not be sent.

Finally, at the end of the mailq command output, it will show the current number of messages in the server queue.

info Messages that could not be delivered will be reattempted after a certain period of time. If the number of delivery attempts for the same message is exceeded, the message will be automatically deleted.

Most common error messages

The most common error messages are some of the following:

'Over quota': The destination email account is completely full.

'Conection refused: This message is usually due to a large volume of mail being processed at the time the message was received/sent. It will be retried later.

'Conection timed out': The error indicates that the destination server is taking too long to respond to the request made from this server. The message will be retried later.

'Service temporarily unavailable': This can commonly be due to the destination server being overloaded or inactive.

For more information about errors when sending mails you can consult the following Manual.

How to check the content of an email message

If the Hosting service from which the message has been sent does not have a TLS security certificate for the mail and the message is in the queue, we will be able to see the content of the message, as well as the headers of the same one.

To install a free TLS certificate for the mail you can follow the following Manual.

In the case that the Hosting service does have the TLS certificate for the mail installed, we will only be able to see the headers of the message. The content of the message will be encrypted and therefore unreadable.

To see the content of a message we will have to use the following command substituting "ID" by the real identifier of the message we want to read:

postcat -q ID
  1. 'From': Account of origin
  2. 'To': Destination account
  3. 'Subject': Subject of the mail message
  4. 'Content': Message body

How to delete mail messages from the server queue

⚠️ IMPORTANT: If you delete an email from the server queue it will be totally impossible recuprearlo⚠️

To delete a mail from the server queue we can do it in different ways:

  1. Delete a single mail: The message with the specified identifier will be deleted (Replace 'ID' with the actual message identifier).
postsuper -d ID
  1. Delete all e-mails from an account: With the following command all e-mails from the specified account will be deleted (Change the example e-mail account).
postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } / manual@swmanuales.com/ { print $1 }' | tr -d '*!' | postsuper -d -
  1. Delete all mails from the server queue: The mail server queue will be emptied.
postsuper -d ALL deferred