• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Mailbox Quota Reaching Notifications

J

JARB

Guest
How do i create in Plesk 9.3 notyfication to admin and client if cleint mailbox is full


Please help

this shel script will be work on plesk 9.3 Debian ?

#! /bin/sh
# warn plesk mailbox users, if mailbox exceeds quota
#
#setenv QMAILUSER 'do-not-reply'
MAILROOT=/var/qmail/mailnames
ADMINMSG=''
cd $MAILROOT > /dev/null
for DIR in *.*;do
QUOTAFILE=$MAILROOT/$DIR/@mbox.quota
# if domainquota exists
if [ -f $QUOTAFILE ]
then
DOMAINHARDQUOTA=`cat $QUOTAFILE`
DOMAINSOFTQUOTA=$((85 * $DOMAINHARDQUOTA / 100))
#echo "$DIR $DOMAINHARDQUOTA - $DOMAINSOFTQUOTA"
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/@mbox.quota
#echo $QUOTAFILE
if [ -f $QUOTAFILE ]
then
HARDQUOTA=`cat $QUOTAFILE`
#echo "using specific $QUOTAFILE, $HARDQUOTA"

SOFTQUOTA=$((85 * $HARDQUOTA / 100))
else
#echo "using domainquota"
HARDQUOTA=$DOMAINHARDQUOTA
SOFTQUOTA=$DOMAINSOFTQUOTA
fi
# calculate space used by mailbox
MBOXSPACE=`du -ks $MAILBOX | cut -f1`
#echo "$MAILBOX@$DIR uses $MBOXSPACE"
if [ $HARDQUOTA -gt 0 -a $MBOXSPACE -gt $SOFTQUOTA ]; then
MBOXPERCENT=$(($MBOXSPACE * 100 / $HARDQUOTA))
echo "$MAILBOX@$DIR belegt $MBOXSPACE kb, Soft/Hardquota = $SOFTQUOTA kb /$HARDQUOTA kb"

#for testing: send warn mail to postmaster account
#mail -r do-not-reply@$DIR -s "Mailbox Quota Warnung" postmaster@yourdomain.tld << EOF
#
#regular: send warn mail to mailbox
mail -r do-not-reply@$DIR -s "Mailbox Quota Warnung" $MAILBOX@$DIR << EOF


Dear $MAILBOX

Your Mailbox currently uses $MBOXSPACE kb ($MBOXPERCENT %) on the mailserver. We would like to
remind you that your mailbox may only contain $HARDQUOTA kb.

To avoid problems when receiving new mail, you should remove read mail from the server.


Regards,
mailbox-robot
EOF



fi
fi
done;

fi



done;
cd /root/bin
 
Last edited by a moderator:
after run this script a have error :


/var/www/vhosts/mydomain/private/mailboxfull.sh: line 7: cd: /var/qmail/mailnames
: No such file or directory
/var/www/vhosts/mydomain/private/mailboxfull.sh: line 8: syntax error near unexpected token `do
'
/var/www/vhosts/mydomain/private/mailboxfull.sh: line 8: `for DIR in *.*;do


Can you help ?
 
Last edited by a moderator:
cd: /var/qmail/mailnames: No such file or directory

Do you have /var/qmail/mailnames directory on your server?
psa-mail-driver-common package contains this directory. Do you have installed this package? Do you have qmail or postfix as your MTA?
 
yes

it's my ls ls -a /var/qmail/ result

.
..
mailnames
popuser
 
what im doing wrong

a run script in cron as root

bash /var/www/vhosts/mydomain/private/mailboxfull.sh
 
Back
Top