How to enable quota display under Roundcube webmail

unihostbrasil

Verified User
Joined
Nov 23, 2009
Messages
170
Location
São Paulo - Brazil
To enable email quota display under Roundcube:

1) Enable DOVECOT quota support (/etc/dovecot.conf):
Code:
mail_plugins = $mail_plugins quota

protocol imap {
  mail_plugins = $mail_plugins imap_quota
}

plugin {
  quota = maildir
}
2) Enable DA quota option and convert all existing password files to use the quota parameter: http://www.directadmin.com/features.php?id=1461

3) Check if Roundcube is correctly configured (/var/www/html/roundcube/config/config.inc.php)
Code:
$rcmail_config['quota_zero_as_unlimited'] = true;
4) Remember to set the pop account quota to something greater than 0 under control panel, otherwise the Roundcube will show 0% for usage.

5) You can define an default quota for new accounts (/usr/local/directadmin/conf/directadmin.conf)
Code:
default_pop_quota=500
We are using this setup for a year in all of our CentOS servers successfully.
 
Last edited:

aleaden

New member
Joined
Jun 26, 2012
Messages
7
hi,
i have a server with directadmin and i'm interested to enable quota plugin...
my server have this configuration
Centos 6.0
DA 1.41.1
Dovecot 2.1.7

I try the howto written up, but does not work...

the code into the /etc/dovecot.conf is to be written at the end of file?

thank you
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
i try to digit into shell, but i receive an error...

Code:
[root@www cron.daily]# sh sync_quota_DA_IMAP.sh
'ync_quota_DA_IMAP.sh: line 2: syntax error near unexpected token `do
sync_quota_DA_IMAP.sh: line 2: `for username in `ls /usr/local/directadmin/data/'sers 2>/dev/null`; do
thank you
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
Check if you did copy correctly.

Regards
ok, i check and i copy the entire text in sync_quota_DA_IMAP.sh
i copied 31 lines in notepad++, then i upload via sftp with filezilla, then chmod 700 with filezilla.
then i open putty (root) and:
Code:
[root@www cron.daily]# sh sync_quota_DA_IMAP.sh
'ync_quota_DA_IMAP.sh: line 2: syntax error near unexpected token `do
sync_quota_DA_IMAP.sh: line 2: `for username in `ls /usr/local/directadmin/data/'sers 2>/dev/null`; do
[root@www cron.daily]#
thank you very much
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,794
Location
A Coruña, Spain
Ok,

here my copy, try this:

Code:
#!/bin/bash
for username in `ls /usr/local/directadmin/data/users 2>/dev/null`; do
{
        for domain in `cat /usr/local/directadmin/data/users/$username/domains.list 2>/dev/null`; do
        {
                for userquota in `cat /etc/virtual/$domain/quota 2>/dev/null`; do
                {
                        USER=`echo $userquota 2>/dev/null | cut -d: -f1 2>/dev/null`
                        QUOTA=`echo $userquota 2>/dev/null | cut -d: -f2 2>/dev/null`S

                        # Force quota recalculation
                        RECALC="-1024 -1"

                        MDPATH=/home/$username/imap/$domain/$USER/Maildir

                        if [ ! -d "$MDPATH" ]; then
                                mkdir $MDPATH
                                chown $username:mail $MDPATH
                                chmod 770 $MDPATH
                        fi

                        echo -e "$QUOTA\n$RECALC" > $MDPATH/maildirsize

                        chown -R $username:mail $MDPATH/maildirsize
                        chmod 660 $MDPATH/maildirsize
                }
                done;
        }
        done;
}
done;
Regards
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,794
Location
A Coruña, Spain
On your pasted error:

Code:
sync_quota_DA_IMAP.sh: line 2: `for username in `ls /usr/local/directadmin/data/'sers 2>/dev/null`; do
Seems there is a starting ' before "for"??

Regards
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
i tried with you correction, but the error is the same...

i attach a picture....

thank you :)

error.jpg
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
Scusa, ho letto adesso la firma... ma sei italiano? forse capisco di più se posso scrivere in italiano...

grazie
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,794
Location
A Coruña, Spain
Si sono italiano ma è meglio scrivere quantomeno la doppia riga anche in inglese così che tutti possano capire. Controllo che quando incolli non vada qualche parola/pezzo di riga a capo.

Yes im italian, but is much better write both language so everyone can understand. Check when you paste if some word/piece of sentence command take a new line

Se vuoi posso anche farlo io ma lo faccio come servizio a pagamento.

If you want i can do the work for you but is a payd service

Saluti

Regards
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
ok, grazie mille. volevo provarci da solo, visto che dovrebbe essere semplice...
ho controllato ed è tutto ok con notepad++
non ho provato con mine... cosa è?

ok, thank you. I wanted to try it out, this should be simple...
I checked and everything is ok with notepad++
I have not tried it with mine ... What is it?
 

aleaden

New member
Joined
Jun 26, 2012
Messages
7
Prova con nano direttamente in shell

Try use nano directly in shell

Regards
ok, i made it!!! :)

i used nano and i wrote the code posted in the first post... now i hope that is updated daily...

thank you very much!!!
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Was the problem perhaps that user aleaden uploaded from windows but didn't set upload as ascii? That will cause improper line endings which can cause problems.

Jeff
 

RaZer0r

Verified User
Joined
Sep 14, 2007
Messages
62
I got the scripts working and the mail quota files are being populated.
but now, there is a difference between roundcube quota and directadmin quota...

see below print-screens to show the results...

directadmin.PNG
roundcube.png

any advice on that difference?
 

unihostbrasil

Verified User
Joined
Nov 23, 2009
Messages
170
Location
São Paulo - Brazil
I got the scripts working and the mail quota files are being populated.
but now, there is a difference between roundcube quota and directadmin quota...

see below print-screens to show the results...

View attachment 1392
View attachment 1393

any advice on that difference?
The quota is synchronized (50MB), but the calculation of used space may vary slightly between webmail and DA, don't worry.
 
Top