Steffen, My problem was exactly what you said, the quota field in my query. I fixed it and now is working very well.
Thank you very much. Alfredo ----- Mensagem original ----- De: "Steffen Kaiser" <skdove...@smail.inf.fh-brs.de> Para: "Alfredo Saldanha" <asalda...@infolink.com.br> Cc: dovecot@dovecot.org Enviadas: Quinta-feira, 2 de outubro de 2014 3:33:13 Assunto: Re: Simply mysql quota check -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, 1 Oct 2014, Alfredo Saldanha wrote: > #/etc/dovecot/dovecot-sql.conf.ext > password_query = \ > SELECT username AS user, value AS password \ > FROM mailboxes WHERE username = '%n@%d' > > user_query = \ > SELECT username, domain, \ > CONCAT('*:storage=', SUBSTRING_INDEX(quota, 'm', 1)*1048576) AS > userdb_quota_rule \ > FROM mailboxes, domains WHERE mailboxes.username = '%n@%d' \ > AND domains.domain = '%d' > > My idea is when a message is delivered, the dovecot to check quota in the > mysql according to the value received in the "user_query" but he does not. > It shows a value of 2GB that I don't know where it gets. > > I execute a manual query in mysql to know the quota my test user and checked > that are 5GB, but when I see the dovecot, it shows 2G. > > SELECT username, domain, CONCAT('*:bytes=', SUBSTRING_INDEX(quota, 'm', > 1)*1048576) AS userdb_quota_rule > FROM mailboxes, domains WHERE mailboxes.username = 'ju...@domain.com' AND > domains.domain = 'domain.com' 1) your manual query uses '*:bytes=', whereas your conf uses '*:storage='. 2) you return the value as userdb_quota_rule, but it must read quota_rule in the user_query. In the password_query fields are prefixed by userdb_ . See http://wiki2.dovecot.org/Quota/Configuration - -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEVAwUBVCzxqnz1H7kL/d9rAQIneAgAukcibxJoQdtwdmrxHbXmKgQsCG22itH5 9VSFGigiPjXg/F1hkj7jHC/xB5uh2M8ayMos+hPxaJkKC4AKYEZu1QEwXAX2qrvN DXt7uPZHLJSMtlWCVb5s6h+v6K3JnbWRrjI4CIfYqB8i8MHKBWei0K02QZcOUOfy KeD7lAIPRuZPnIEiWYREpalRMGeQzZ69SHEmhxDx7VFO5FanlHDxdCwmO7qHoJen ZuNpUWMf5i5czxcDhHjLdtGODv005LFDCXhj48SqI17WzD3mPjJegOCjym6RfKmU RT+PtKieBkzygT1YzvjJbHISFxJSryVg8c48tCb0FgjkNKWXq/KsPg== =wzY8 -----END PGP SIGNATURE-----