Postfix mysql 临时查找失败

Postfix mysql 临时查找失败

我正在尝试配置 postfix/courier/mysql/SquirrelMail 设置,使用本指南,但是当我尝试发送电子邮件时出现以下错误:

451 4.3.0 <[email protected]>: Temporary lookup failure

/var/log/mail.log条目:

Mar 16 11:37:42 myserver postfix/smtpd[12750]: connect from localhost[127.0.0.1]
Mar 16 11:37:42 myserver postfix/smtpd[12750]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Mar 16 11:37:42 myserver postfix/smtpd[12750]: warning: mysql:/etc/postfix/mysql-virtual_email2email.cf lookup error for "[email protected]"
Mar 16 11:37:42 myserver postfix/smtpd[12750]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.0 <[email protected]>: Temporary lookup failure; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<webmail.mydomain.com>
Mar 16 11:37:42 myserver postfix/smtpd[12750]: lost connection after RCPT from localhost[127.0.0.1]
Mar 16 11:37:42 myserver postfix/smtpd[12750]: disconnect from localhost[127.0.0.1]

我重新检查了 /etc/postfix/mysql-virtual_email2email.cf 文件,它配置正确。

user = mypostfixusername
password = mypass
dbname = mail
query = SELECT email FROM users WHERE email='%s'
host = 127.0.0.1

我的 mysql 服务器正在运行,我可以使用 mysql -u mypostfixusername -p 连接到它,并可以运行查询。我也可以使用 SquirrelMail 登录。

答案1

你的最后一行/etc/postfix/mysql-virtual_email2email.cf应该是

hosts = 127.0.0.1

代替

host = 127.0.0.1

如果我们指定127.0.0.1postfix 应该尝试连接,TCP但您的日志行显示 postfix 无法连接/var/run/mysqld/mysqld.sock,因此它无法识别该host = 127.0.0.1行。希望对您有所帮助。

相关内容