• 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

qmail - notification to sender when mailbox quota exceeded

netdiver

New Pleskian
qmail - no notification to sender when mailbox quota exceeded

Dear Plesk Team,

we have a little problem on out Plesk 11.0.9 - qmail - Ubuntu Server.

When we set a quota to a mailbox (i.e. 5MB) and send a mail from an external server that would exceed the quota of this mailbox the mail just disappears.
The mailbox owner does not get a message and - which is more important - the sender does not even get a well formatted error message or not even a mail-delivery-notification.

How can we fix this problem?
Did we miss a flag oder a configuration file where we could configure that?

NetDiver
 
Last edited:
Just noticed this too when a customer was complaining of not receiving "all" mail.
The Mail-Log shows "delivered to plesk_virtual" but nothing appears in the Mail-Folder. Then I found another maillog file in
/usr/local/psa/var/log/maillog and maillog.processed
Here it states, that user exceeded his quota. But again, no log entry that it even tried to send a notification to either the Hoster, Customer or Subscriber!!!
Weird thing is though, that some mail arrived at the mailbox and some didn't.

FIX REQUIRED!!!

My only current workaround is to increase the Mailbox-Quota or have the customer delete mails.
 
I use the following script run daily from cron. (from another forum post) It works pretty well.

Code:
#! /bin/bash
# Mail quota reaching it's limit e-mail notification
# script for Plesk 9.3+ / Plesk 10 & Qmail
# Modified by "Scy" from the original script
# provided by "azur99" in Plesk forum:
# http://forum.parallels.com/showthread.php?t=71666
#setenv QMAILUSER 'do-not-reply'
MAILROOT=/var/qmail/mailnames
cd $MAILROOT > /dev/null
for DIR in *.*;do
        cd $MAILROOT/$DIR
        for MAILBOX in * ;do
                if [ -d $MAILBOX ]
                        then

                        # look for specific mailbox quota file and set mailbox softquota
                        QUOTAFILE=$MAILROOT/$DIR/$MAILBOX/Maildir/maildirsize
			
			# Fetching mailbox quota size in bytes
			HARDQUOTA=$((`head -1 $QUOTAFILE | cut -d S -f1`))
			if [ "$HARDQUOTA" -eq 0 ]; then 
				continue
			fi
		
			# Fetching space used by mailbox in bytes
			MBOXSPACE=$((`tail -n +2 $QUOTAFILE | cut -c1-12 | paste -sd+|bc`))

			# Calculate the quota limit required for mail warning (85% for default)
			SOFTQUOTA=$((85 * $HARDQUOTA / 100))

			# Calculate mailbox usage percentage (with two decimals)
			MBOXPERCENT=$(echo "scale=2; $MBOXSPACE*100/$HARDQUOTA" | bc)

			# Check if the mailbox is full enough for warning, and if, send the warning mail
            if [ $HARDQUOTA -gt 0 -a $MBOXSPACE -gt $SOFTQUOTA ]; then
			
				# Let's generate the values in megabytes (with two decimals)
				HARDQUOTA=$(echo "scale=2; $HARDQUOTA/1048576" | bc)
				if [ "$(echo $HARDQUOTA | cut -c1)" = "." ] ; then HARDQUOTA="0"$HARDQUOTA
				fi
				MBOXSPACE=$(echo "scale=2; $MBOXSPACE/1048576" | bc)
				if [ "$(echo $MBOXSPACE | cut -c1)" = "." ] ; then MBOXSPACE="0"$MBOXSPACE
				fi
			
/usr/sbin/sendmail -t << EOF
To: $MAILBOX@$DIR 
From: ******@*******.com
Bcc: ****@******.com
Subject: Your mailbox is almost full
Dear mail user,

Your e-mail $MAILBOX@$DIR is about to reach its maximum quota. You are using $MBOXSPACE MB ($MBOXPERCENT%) out of the maximum quota $HARDQUOTA MB.

We would kindly suggest you to delete some older messages and purge them to free some space in the mailbox. If the quota limit is reached, you won't be able to receive any new messages and the sender will receive  'mail quota exceeded' notifications.

Another option is to configure your POP3 mail client (e.g. Microsoft Outlook, Mozilla Thunderbird or Apple Mail) to delete the messages on the server mailbox every time the mail account is read.

This is an automated message, do not reply. If you require any assistance, please open a support ticket at http://*******/support.php .
EOF

			fi


				fi
        done;

done;
 
Back
Top