Applicable to:
- Plesk for Linux
Symptoms
A lot of messages from MAILER-DAEMON@example.com
are stuck in the queue (Tools & Settings > Mail Server Settings > Mail Queue):
The number of such messages is growing exponentially.
The recipient's server (johndoe@example.org
) is not reachable:
# telnet example.org 25
Trying 203.0.113.2...
telnet: connect to address 203.0.113.2: Connection timed out
Cause
Outgoing spam was sending (or being sent at the moment) to the addresses that do not exist or are not reachable at the moment.
Resolution
Warning: The below steps are temporary measures. To manage outbound spam protection settings, refer to the following documentation:
Protection From Outbound Spam
As a workaround, automatic cleaning may be set up as a scheduled task:
-
In Tools & Settings > Scheduled Tasks > Add Task. Fill in as follows:
CONFIG_TEXT: Active
Task type: Run a command
Command: /usr/local/psa/admin/sbin/mailqueuemng --clean
Run: Hourly (set any time)
Description: it flushes the mail queueThe second task:
CONFIG_TEXT: Active
Task type: Run a command
Command: mailq|gawk '/MAILER-DAEMON/ { print $1 }'|/usr/sbin/postsuper -d -
Run: Hourly (set it after two-three minutes past the first one)
Description: delete bounces
Mail Queue will be cleaned once in an hour.
Comments
5 comments
First thing is that postqueue -f alone would not work as cron.
So use
instead.
Second thing, I would recommend to use the following script, because "postsuper -d ALL" would delete ALL messages from the queue, not only the ones from mailer-deamon:
This removes only the unwanted mails from queue.
@TorbenH Thank you a lot for the hints! The article was updated.
Command: /usr/local/psa/admin/sbin/mailqueuemng --clean
Can this be modified to clean messages only from the deferred queue?
@Ian Tresman
The deferred queue can be emptied using the following command:
# postsuper -d ALL deferred
To resend all deferred email, use the following one:
# postsuper -r ALL
Check the following article, as well: https://support.plesk.com/hc/en-us/articles/115003159349
Thank you!
Please sign in to leave a comment.