Files
NewSzxcn-Email/deploy/postfix/sqlite-mailboxes.cf
LanQin_ 6ebbb47012 fix(mail): 统一邮箱查询的大小写与别名匹配
- 将 Postfix/Dovecot 的 SQL 查询改为忽略大小写匹配,减少地址大小写导致的投递失败。
- 支持带 `+` 的详细地址解析,并基于域表关联定位邮箱目录。
- 启用 `lda_mailbox_autocreate`,确保投递到详细邮箱时可自动创建邮箱目录。
2026-06-17 14:15:03 +08:00

3 lines
1.2 KiB
CFEngine3

dbpath = /data/lanqin.db
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')