[Dovecot] quota warning email to user

upen upendra.gandhi at gmail.com
Fri Mar 25 18:20:36 EET 2011


> Hi,
>
> I am trying to use Quota in dovecot-2.0.11. I find as a sender(same
> user a receiver) I receive an email that receiver's Quota is exceeded
> , and receiver's mailbox is full . This is good, however the receiver
> whose MB is full isn't getting any quota-warning. Configuration is as
> below,
>
>
> dovecot -n
> # 2.0.11: /etc/dovecot/dovecot.conf
> # OS: Linux 2.6.35-gentoo-r8 x86_64 Gentoo Base System release 1.12.14 ext4
> auth_mechanisms = plain login
> listen = *
> mail_location = maildir:/nfs1/mail/%u
> mail_plugins = " quota"
> passdb {
>  args = *
>  driver = pam
> }
> plugin/quota = maildir:User quota
> plugin/quota_rule = *:storage=5M
> plugin/quota_rule2 = Trash:storage=+1M
> plugin/quota_rule3 = Junk:storage=+1M
> plugin/quota_warning = storage=95%% quota-warning 95 %u
> plugin/quota_warning2 = storage=80%% quota-warning 80 %u
> service quota-warning {
>  executable = script /usr/local/bin/quota-warning.sh
>  user = dovecot
> }
> ssl_cert = </etc/postfix/ssl/smtpd.pem
> ssl_cipher_list = ALL:!LOW:!SSLv2
> ssl_key = </etc/postfix/ssl/smtpd.pem
> userdb {
>  driver = passwd
> }
> protocol imap {
>  mail_plugins = " quota imap_quota"
>
>
> Mar 24 15:41:28 email_serverdovecot: imap(local_username): Error:
> quota: net_connect_unix(/var/run/dovecot/quota-warning) failed:
> Permission denied (euid=1002(local_username) egid=10(wheel) missing +r
> perm: /var/run/dovecot/quota-warning, euid is not dir owner)
> Mar 24 15:41:28 email_serverdovecot: lda(local_username):
> msgid=<20110324154128.0df8855a at local_username_ots.domainname>: save
> failed to INBOX: Quota exceeded (mailbox for user is full)
> Mar 24 15:41:28 email_serverdovecot: lda(local_username):
> msgid=<20110324154128.0df8855a at local_username_ots.domainname>:
> rejected: Quota exceeded (mailbox for user is full)
> Mar 24 15:41:28 email_serverpostfix/pickup[25550]: D25C121BB4: uid=1002 from=<>
>
>
> ls -al /var/run/dovecot/
> total 20
> drwxr-xr-x  4 root    root     4096 Mar 24 15:35 .
> drwxr-xr-x 33 root    root     4096 Mar 24 14:54 ..
> srw-------  1 root    root        0 Mar 24 15:35 anvil
> srw-------  1 root    root        0 Mar 24 15:35 anvil-auth-penalty
> srw-------  1 root    root        0 Mar 24 15:35 auth-client
> srw-------  1 dovecot root        0 Mar 24 15:35 auth-login
> srw-------  1 root    root        0 Mar 24 15:35 auth-master
> srw-------  1 root    root        0 Mar 24 15:35 auth-userdb
> srw-------  1 dovecot root        0 Mar 24 15:35 auth-worker
> srw-------  1 root    root        0 Mar 24 15:35 config
> srw-------  1 root    root        0 Mar 24 15:35 dict
> srw-------  1 root    root        0 Mar 24 15:35 director-admin
> srw-------  1 root    root        0 Mar 24 15:35 director-userdb
> srw-rw-rw-  1 root    root        0 Mar 24 15:35 dns-client
> srw-------  1 root    root        0 Mar 24 15:35 doveadm-server
> lrwxrwxrwx  1 root    root       25 Mar 24 15:35 dovecot.conf ->
> /etc/dovecot/dovecot.conf
> drwxr-xr-x  2 root    root     4096 Mar 16 13:24 empty
> srw-rw-rw-  1 root    root        0 Mar 24 15:35 lmtp
> drwxr-x---  2 root    dovenull 4096 Mar 24 15:35 login
> -rw-------  1 root    root        6 Mar 24 15:35 master.pid
> srw-------  1 root    root        0 Mar 24 15:35 quota-warning
>
> ls -al /usr/local/bin/quota-warning.sh
> -rwxrwxrwx 1 root root 225 Mar 24 13:16 /usr/local/bin/quota-warning.sh
>
> cat /usr/local/bin/quota-warning.sh
> #!/bin/sh
> PERCENT=$1
> USER=$2
> cat << EOF | /usr/libexec/dovecot/dovecot-lda -d $USER -o
> "plugin/quota=maildir:User quota:noenforcing"
> From: postmaster at domain.com
> Subject: quota warning
>
> Your mailbox is now $PERCENT% full.
> EOF
>
>
> ###
>
> Any help is appreciated.
>
> Thanks.
>

Owner of an over quota account just got an email when some emails were
deleted from it (no date on that email though, don't understand why)

Don't know what resolved the issue, I did following changes recently,

chmod 700  /usr/local/bin/quota-warning.sh

Edit , 90-quota.conf as below,

service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
# use some unprivileged user for executing the quota warnings
user = root
unix_listener quota-warning {
mode = 0666
user = root
group = root
   }
  }

/etc/init.d/dovecot restart

ls -al /var/run/dovecot/quota-warning
srw-rw-rw- 1 root root 0 Mar 24 20:23 quota-warning

Thanks,


More information about the dovecot mailing list