1

Topic: Ignore trash and junk folders in quota MariaDB

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version:  CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi, after following the instructions of this link (https://docs.iredmail.org/ignore.trash. … quota.html), I can not access the accounts, and dovecot shows the following error:

dovecot[15358]: auth-worker(16309): Error: sql(example@example.com): User query failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Trash:ignore' AS quota_rule2 'Junk:ignore' AS quota_rule3 FROM mailbox,domain W' at line 1

The file /etc/dovecot/dovecot-mysql.conf is like this:

user_query = SELECT \
    '%u' AS master_user, \
    LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home, \
    CONCAT(mailbox.mailboxformat, ':~/', mailbox.mailboxfolder, '/') AS mail, \
    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
    'Trash:ignore' AS quota_rule2 \
    'Junk:ignore' AS quota_rule3 \
FROM mailbox,domain \


If I add a comma at the end of "quota_rule" and "quota_rule2", there are no problems, but I'm not sure if it's the right thing to do. Can you confirm that it is okay?

user_query = SELECT \
    '%u' AS master_user, \
    LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home, \
    CONCAT(mailbox.mailboxformat, ':~/', mailbox.mailboxfolder, '/') AS mail, \
    CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule, \
    'Trash:ignore' AS quota_rule2, \
    'Junk:ignore' AS quota_rule3 \
FROM mailbox,domain \

Thank you!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Ignore trash and junk folders in quota MariaDB

Afro wrote:

If I add a comma at the end of "quota_rule" and "quota_rule2", there are no problems, but I'm not sure if it's the right thing to do. Can you confirm that it is okay?

This is correct syntax.

3

Re: Ignore trash and junk folders in quota MariaDB

ZhangHuangbin wrote:
Afro wrote:

If I add a comma at the end of "quota_rule" and "quota_rule2", there are no problems, but I'm not sure if it's the right thing to do. Can you confirm that it is okay?

This is correct syntax.

Thank you!