fix(mail): 统一邮箱查询的大小写与别名匹配
- 将 Postfix/Dovecot 的 SQL 查询改为忽略大小写匹配,减少地址大小写导致的投递失败。 - 支持带 `+` 的详细地址解析,并基于域表关联定位邮箱目录。 - 启用 `lda_mailbox_autocreate`,确保投递到详细邮箱时可自动创建邮箱目录。
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
dbpath = /data/lanqin.db
|
||||
query = SELECT 'vhosts/' || substr(address, instr(address, '@') + 1) || '/' || local_part || '/Maildir/' FROM mailboxes WHERE address='%s' AND status='active' UNION SELECT 'vhosts/' || substr('%s', instr('%s', '@') + 1) || '/__unregistered__/Maildir/' WHERE EXISTS (SELECT 1 FROM system_settings WHERE key='catchAllEnabled' AND value='true') AND EXISTS (SELECT 1 FROM domains WHERE name=substr('%s', instr('%s', '@') + 1) AND status='active') AND NOT EXISTS (SELECT 1 FROM mailboxes WHERE address='%s' AND status='active')
|
||||
query = SELECT 'vhosts/' || d.name || '/' || m.local_part || '/Maildir/' FROM mailboxes m JOIN domains d ON d.id=m.domain_id WHERE d.name=lower(substr('%s', instr('%s', '@') + 1)) AND m.local_part=lower(CASE WHEN instr(substr('%s', 1, instr('%s', '@') - 1), '+') > 0 THEN substr(substr('%s', 1, instr('%s', '@') - 1), 1, instr(substr('%s', 1, instr('%s', '@') - 1), '+') - 1) ELSE substr('%s', 1, instr('%s', '@') - 1) END) AND m.status='active' AND d.status='active' UNION SELECT 'vhosts/' || lower(substr('%s', instr('%s', '@') + 1)) || '/__unregistered__/Maildir/' WHERE EXISTS (SELECT 1 FROM system_settings WHERE key='catchAllEnabled' AND value='true') AND EXISTS (SELECT 1 FROM domains WHERE name=lower(substr('%s', instr('%s', '@') + 1)) AND status='active') AND NOT EXISTS (SELECT 1 FROM mailboxes m JOIN domains d ON d.id=m.domain_id WHERE d.name=lower(substr('%s', instr('%s', '@') + 1)) AND m.local_part=lower(CASE WHEN instr(substr('%s', 1, instr('%s', '@') - 1), '+') > 0 THEN substr(substr('%s', 1, instr('%s', '@') - 1), 1, instr(substr('%s', 1, instr('%s', '@') - 1), '+') - 1) ELSE substr('%s', 1, instr('%s', '@') - 1) END) AND m.status='active')
|
||||
|
||||
Reference in New Issue
Block a user