因此,出现了以下问题。我正尝试按照此处的教程大致设置一个邮件服务器:https://workaround.org/ispmail/wheezy/
当我尝试发送我的第一个测试邮件(在系统内部)时,问题开始出现,我收到以下信息:
postfix/pickup[15883]: F34B965841CF: uid=1000 from=<webmaster>
postfix/cleanup[15907]: F34B965841CF: [email protected]>
postfix/qmgr[15884]: F34B965841CF: from=<[email protected]>, size=398, nrcpt=1 (queue active)
dovecot: auth-worker(15911): Warning: mysql: Query failed, retrying: 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 '@example.org.' at line 1
dovecot: auth-worker(15911): Error: sql([email protected]): Password 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 '@example.org.' at line 1
dovecot: lda: Error: user [email protected]: Auth USER lookup failed
dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.
postfix/pipe[15909]: F34B965841CF: to=<[email protected]>, relay=dovecot, delay=0.02, delays=0.01/0/0/0.02, dsn=4.3.0, status=deferred (temporary failure)
问题是,在本教程的前面,你应该手动尝试你的 sql 查询是否适用于
postmap -q example.org mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
等等。对我来说,它确实有效。完全没有问题。
我的文件看起来和教程中的差不多
mysql-虚拟邮箱域.cf
user = mailuser
password = <pw>
hosts = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'
mysql-虚拟别名-maps.cf
user = mailuser
password = <pw>
hosts = mailserver
query = SELECT destination FROM virtual_aliases WHERE source='%s'
等等。有人遇到过这种情况吗?有什么解决方案或想法吗?
答案1
根据日志显示失败是password_query
dovecot 发出的。
教程来自https://workaround.org/ispmail/wheezy/setting-up-dovecot
逐字粘贴的查询是:
password_query = SELECT email as user, password FROM virtual_users WHERE email=’%u’;
周围的引号%u
是 Unicode 引号,而不是普通的 ASCII 引号。这是错误的,这也解释了为什么如果您像我上面那样复制粘贴该查询,查询就会失败。它们必须替换为普通的单引号,如下所示:
password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';
通常,这是教程使用的发布平台的错误,它使用过滤器自动将普通引号替换为花哨的引号。在发布代码时,这是完全错误的。https://en.wikipedia.org/wiki/Quotation_mark有一个段落是讨论这种做法的。