Author Topic: SVN Revision 829 - 'Could not move the message' with dovecot and quota  (Read 7661 times)

Offline timelord

  • Jr. Member
  • **
  • Posts: 15
Hi, sorry for strange "Subject" ;)

Here is the explanation:

- OS CentOS 5.0
- dovecot-1.0-1.2.rc15.el5
- Roundcube (SVN Revision 829)
- MySQL 5.0.45-0.rhel5
- Apache 2.2.3-7.el5.centos
- php-5.1.6-15.el5
- postfix 2.4.5
- postfixAdmin

All my users (email accounts) are stored in MySQL. I use postfixAdmin for their administration.

Postfix:

/etc/postfix/main.cf

Code: [Select]
#...
smtpd_sasl_type = dovecot
#...

Roundcube:

config/main.inc.php

Code: [Select]
//...
$rcmail_config['default_host'] = '127.0.0.1';
$rcmail_config['default_port'] = 143;
$rcmail_config['smtp_server'] = '127.0.0.1';
$rcmail_config['smtp_port'] = 25;
//...

Dovecot:

/etc/dovecot.conf

Code: [Select]
#...
mail_location = maildir:/var/spool/vmail/%h

protocol imap {
 #...
 mail_plugins =
 #...
}

protocol pop3 {
 #...
 mail_plugins =
 #...
}

auth default {
 passdb sql {
   args = /etc/dovecot-mysql.conf
 }
 userdb sql {
   args = /etc/dovecot-mysql.conf
 }
 socket listen {
   client {
    path = /var/spool/postfix/private/auth
    mode = 0660
    user = postfix
    group = postfix
   }
 }
 #...
}
#...

and finally:
/etc/dovecot-mysql.conf

Code: [Select]
driver = mysql
default_pass_scheme = CRYPT
connect = host=localhost dbname=mydb user=myuser password=mypasswd

password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'
user_query = SELECT maildir AS home, 1001 AS uid, 1001 AS gid FROM mailbox WHERE username = '%u' AND active = '1'

With this configuration everything works great. I have no problem with postfix+TLS+AUTH, no problem with dovecot, no problem with Roundcube. But I cannot see Disk usage in Rouncube webinterface.

So I have changed mail_plugins in /etc/dovecot.conf:

Code: [Select]
protocol imap {
 #...
 mail_plugins = quota imap_quota
 #...
}

protocol pop3 {
 #...
 mail_plugins = quota
 #...
}

and user_query in /etc/dovecot-mysql.conf

Code: [Select]
user_query = SELECT maildir AS home, 1001 AS uid, 1001 AS gid, CONCAT('dirsize:storage=', floor(mailbox.quota/1000)) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
and now I can see Disk usage and everything is perfect ... almost perfect :)

With this configuration Roundcube cannot move emails among the folders or delete emails. Everytime I try to move or delete email I can see the error message: Could not move the message. But Outlook (IMAP) can move/delete email without any problem.

If I change mail_plugins and user_query back to the previous values, I cannot see Disk usage but Roundcube can move/delete emails again.

Is it Rouncube bug or "my bug" ? :D

Any suggestions, please? Thank you.

UPDATED
SCUBA LIBRE :D

Offline timelord

  • Jr. Member
  • **
  • Posts: 15
Re: SVN Revision 829 - 'Could not move the message' with dovecot and quota
« Reply #1 on: September 26, 2007, 11:27:54 PM »
Well, sorry for my previous post, I think I know where the problem is.

0 means unlimited quota for PostfixAdmin.

If mailbox.quota = 0 (unlimited for postfixAdmin and postfix) then 0/1000 in

Code: [Select]
user_query = SELECT maildir AS home, 1001 AS uid, 1001 AS gid, CONCAT('dirsize:storage=', floor(mailbox.quota/1000)) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
is 0 again, but 0 is not unlimited for dovecot. For dovecot it means 0 kB, no free space :(

That's why Outlook was able to delete email and Roundcube was not (Roudcube was able to delete email from Trash only).

Does anybody know what is the unlimited quota value for dovecot? Thanks for help.
SCUBA LIBRE :D

Offline timelord

  • Jr. Member
  • **
  • Posts: 15
Re: SVN Revision 829 - 'Could not move the message' with dovecot and quota
« Reply #2 on: September 27, 2007, 12:23:38 AM »
I'm here again ;)

It seems like -1 is unlimited quota for dovecot, so I've changed user_query and it looks like this:

Code: [Select]
user_query = SELECT maildir AS home, 1001 AS uid, 1001 AS gid, CONCAT('dirsize:storage=', floor(IF(quota!=0, quota,-1)/1000)) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
Now it works great. I can see Disk usage and can move/delete emails.

But .. :) .. how can email be deleted in Roundcube webinterface (Roundcube checks IMAP for quota limit) if quota has been changed to the lower value than current disk usage?

Fo example:
- before: disk usage = 170 MB, quota = 200 MB
- now: disk usage = 170 MB, quota = 150 MB

In such situation it's impossible to delete/move email again. Roundcube wants to move email to Trash, but dovecot does not want to allow that (quota exceeded).

Thanks :)
SCUBA LIBRE :D

Offline heilong

  • Newbie
  • *
  • Posts: 1
SVN Revision 829 - 'Could not move the message' with dovecot and quota
« Reply #3 on: June 02, 2009, 03:06:22 AM »
Hey timelord! Did you figure out how to fix this problem (impossible to delete/move email again)?