1

Topic: Mailbox size admin and notification

When the mailbox reached 80%, user will receive a message to notify them the mailbox size is reached 80%.  I would like to know how to modify it to notify the user and the domain admin.  Also we are looking for any solution which the admin can show all domain's mailbox size.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Mailbox size admin and notification

bongdotcom wrote:

When the mailbox reached 80%, user will receive a message to notify them the mailbox size is reached 80%.  I would like to know how to modify it to notify the user and the domain admin.  Also we are looking for any solution which the admin can show all domain's mailbox size.

/usr/bin/dovecot-quota-warning.sh
MYSQL_USER='vmail'
PASSWD='passwd'
VMAIL_DB_NAME='vmail'
PERCENT=${1}

cat << EOF | /usr/lib/dovecot/deliver -d ${USER} -c /etc/dovecot/dovecot.conf
From: no-reply@yourdomain.net
Subject: Mailbox Quota Warning: ${PERCENT}% Full.
Your mailbox is now ${PERCENT}% full, please clean up some mails for
further incoming mails.
EOF

DOMAIN=${USER##*@}
ADMIN=`mysql -s -u${MYSQL_USER} -p${PASSWD} ${VMAIL_DB_NAME} <<EOF
    SELECT username FROM domain_admins WHERE domain='$DOMAIN' AND active=1 AND expired >= NOW();
EOF`

if ! [ -z "$ADMIN" ]; then
cat << EOF | /usr/lib/dovecot/deliver -d ${ADMIN} -c /etc/dovecot/dovecot.conf
From: no-reply@yourdomain.net
Subject: Mailbox Quota Warning: ${PERCENT}% Full.
Your mailbox is now ${PERCENT}% full, please clean up some mails for further incoming mails.
fi

3

Re: Mailbox size admin and notification

Hi, @whitefox.

Why not get ADMIN first, and add 'CC:' in RAW mail header if it's not empty? smile

4

Re: Mailbox size admin and notification

ZhangHuangbin wrote:

Hi, @whitefox.

Why not get ADMIN first, and add 'CC:' in RAW mail header if it's not empty? smile

/usr/lib/dovecot/deliver can not send CC he only puts in one mailbox

http://wiki.dovecot.org/LDA

5

Re: Mailbox size admin and notification

whitefox wrote:

/usr/lib/dovecot/deliver can not send CC he only puts in one mailbox

Yes you are right. Thanks for your sharing smile

6

Re: Mailbox size admin and notification

/usr/lib/dovecot/deliver can not send CC he only puts in one mailbox

Have a look to http://wiki.dovecot.org/Quota/1.1. See "Quota warnings" and use the script with sendmail to deliver. Insert the line

cat $qwf | /usr/sbin/sendmail -f $FROM "$FROM"

after

cat $qwf | /usr/sbin/sendmail -f $FROM "$USER"

Now the script sends two messages - to user and to postmaster. It works perfect for me.

mbsouth

7

Re: Mailbox size admin and notification

Hi,
we have found post regarding email alert to admin and user when mailbox quota of user exceeds the limit for dovecot mysql backend,would you tell us how to do it in dovecot ldap backend.

Regards,
Pinemail11

8

Re: Mailbox size admin and notification

Hi PineMail11,

Please do not hijack other's thread, just post your question in a new forum topic instead.

To alter admin, just add admin email in BCC.