Yachine-san,

I very much appreciate you giving me the very useful information on my question.

Masaharu Kawada

On 2016年06月15日 19:36, chaouche yacine wrote:
I personnaly use courier's maildirmake, which is a real binary unlike 
dovecote's maildirmake which is a thin bash wrapper around the linux mkdir 
command. Courier's maildirmake on the other hand has this nice -q option that 
let you specify a quota, at creation time of afterwards.

I'm using it in a script like this :

root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL # cat setupquota.single

if [[ "$#" = 0 ]]
then
     echo "usage : $0 bo...@domain.com [quota en megas]"
     exit 1
fi

quota=$((1024*1024*1024)) #1Go
inbox="${1%@*}"
maildir="/var/vmail/example.domain/$inbox"
backup="/var/vmail/backup.example.domain/$inbox"

if [[ "$#" = 2 ]]
then
     quota=$((1024*1024*$2))
fi



function set_quota {
     local quota="$1"
     local dst="$2"
     echo maildirmake.courier -q "$quota"S "$dst"
     maildirmake.courier -q "$quota"S "$dst"
     echo chown vmail:vmail -R "$dst"
     chown vmail:vmail -R "$dst"
}

set_quota "$quota" "$maildir"
quota=$(( 1024 * 1024 * 1024 *  5 )) # 5Go
set_quota "$quota" "$backup"
echo "-------------------------------------------------------------------------"
root@messagerie[CHROOT][10.10.10.20] ~/SCRIPTS/MAIL #


And use it like this :

root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # ./setupquota.single 
h.messamri@example.domain 1024




       From: "mkaw...@redhat.com" <mkaw...@redhat.com>
  To: dovecot@dovecot.org
  Sent: Wednesday, June 15, 2016 1:20 AM
  Subject: quota rules for mail users
Dear All,

Is it possible to make quota rules under $HOME/Maildir/* mailboxes with
a specific command such as 'edquota' when the first email arrives at the
$HOME/Maildir/{new,cur,tmp} of a user. In the below example, the <UserB>
is the one who gets an email for the first time.

&é"edquota  -p  <UserA> <UserB>

---man edquot---
-p, --prototype=protoname
Duplicate the quotas of the prototypical user specified for each user
specified. This is the normal mechanism used to initialize quotas for
groups of users.
---

To configure quotas in postfix/dovecot environment, it seems that you
need to use dovecot-lda plugin, and then my exact question is as follows:

Is it possible to automatically run any commands or scripts in order to
set a quota rule to $HOME/Maildir/* mailboxes when users receive an
email for the first time? I just found the post-login service allows you
to execute scripts after authentication in the following URL, but I have
not found the exact way to make it.

http://www.dovecot.org/list/dovecot/2009-November/044279.html

Any comments/suggestions would be greatly appreciated.



--
Masaharu Kawada

Reply via email to