• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk not forwarding e-mail after mailbox full

Olga_Mataev

New Pleskian
I'm running Plesk 11.0.9 Update #62, using postfix as my mail service

Here is the problem: postfix does not execute the other commands in the .qmail file if the deliverquota command fails. If my .qmail file looks like this:

| true
| /usr/bin/deliverquota ./Maildir
&[email protected]

Postfix will try to run deliverquota, which returns "mail quota exceeded", at which point the postfix does not go any further. I want postfix to forward the e-mail to [email protected] regardless of what deliverquote returns. I have so far worked around this by manually changing the .qmail file to look like this:

| true
&[email protected]
| /usr/bin/deliverquota ./Maildir

The behavior is now correct. However, I don't want to manually change all the .qmail files, and I also don't want to risk this being changed again next time Plesk re-builds the files, for example after an update.

By the way, the reason that I have the mailboxes in the first place is because Plesk doesn't allow me to create an SMTP account without creating a mailbox. Most of my users use gmail to receive mail, but want to use my server to send the mail. If I disable the mailbox on Plesk and leave only forwarding, the SMTP is disabled.

Has anybody run into this before and found a way to resolve it?
 
Olga,

In accordance with qmail behavior outlined in the dot-qmail(5) man page in “ERROR HANDLING” section:


If a delivery instruction fails, qmail-local stops immediately and reports failure. qmail-local handles forwarding after all other instructions, so any error in another type of delivery will prevent all forwarding.
If a program returns exit code 99, qmail-local ignores all succeeding lines in .qmail, but it still pays attention to previous forward lines.

As a temporary solution you may suppress deliverquota exit code like so:

| /usr/bin/deliverquota ./Maildir || :


This will force all other actions to execute and delivery will be counted as successful, so the mail will be removed from the mail queue. Also this will likely be overwritten on the next mail settings update for this mailbox (figuring out which actions will actually change this requires additional testing/investigation).


Another good solution is to simply move forwarding line before delivery line. This way even if delivery will fail, mail will be forwarded (though in older Plesk versions, such as 11.0, mail may be left in queue and on the next delivery attempt it will be forwarded again, flooding the forward mail address with same mails; if I’m not mistaken, this behavior is fixed in the latest version – not sure if the fix is already shipped – ask Misha about that).


Another possible solution is to simply enable mail quota checking on SMTP stage (which is enabled by default). That way (except in extremely rare cases with race conditions), deliverquota should never fail due to quota being exceeded, such mails will be rejected before actually accepting them. Therefore any mail that reached .qmail processing will be delivered and forwarded. I recommend to use this solution, if possible.
 
Hi Alexey,

How do I enable mail quota checking on the SMTP stage?

Edited to add: you were correct - the temporary solution that I used by switching around the forwarding and delivery lines was overwritten when Plesk was updated again.
 
Olga,

Simplest diagnostic is to run the following:
# /usr/local/psa/admin/sbin/mail_handlers_control --list | grep check-quota
| X | 10 | all-recipients | check-quota | global | before-queue |

Output is provided for Plesk 11.0.9. If this handler is absent, overquota events will be fired at delivery stage, otherwise at SMTP stage.

To re-enable the handler, mchk or mail_restore command tool call should be sufficient.
 
This is the output that I get. However, the behavior is still abnormal. For now, I have set up a scheduled task to clear out the contents of ./Maildir/new when its size is over quota.
 
Back
Top