我花了几天的时间尝试设置Postfix与SASLDB在Ubuntu Server 15.04上通过SMTP从我的应用程序发送电子邮件。 我search,阅读和testing了很多,但我无法得到它的工作。 Postfix和邮件服务器对我来说是新的,所以我希望有人能帮助我。
得到了Ubuntu Server 15.04 x64的干净安装。
运行这个脚本来安装和configurationPostfix,SASL AUTH: https : //gist.github.com/richarddong/2634350
修正SASLAUTHD以使用chrooted Postfix(3.和4.段落): https : //github.com/webmin/webmin/issues/58#issuecomment-22985720
修复connect(): testaslauthd命令没有这样的文件或目录错误。
我用saslpasswd2 -c -u example.com username创build了一个用户。
使用sasldblistusers2成功validation它,然后用以下方法sasldblistusers2进行testing:
testsaslauthd -u [email protected] -p password
testsaslauthd -u username -p password -r example.com
testsaslauthd -u [email protected] -p password -s smtp
testsaslauthd -u username -p password -r example.com -s smtp
testsaslauthd -u username -p password
但所有这些返回: 0:没有“身份validation失败” 。
它只接受root用户和密码,比如testsaslauthd -u root -p password 。
我检查了configuration,发现它没有使用SASLDB,所以我跟着这个: https ://serverfault.com/a/547851/317421
SASL后,Postfix的configuration结果和我上面写的一样。
我试着用root用户telnet localhost 25 ,连接,然后AUTH PLAIN base64string ,其中base64string生成者:
perl -MMIME::Base64 -e 'print encode_base64("\000root\000password");'
但返回535 5.7.8 Error: authentication failed: generic failure 。
当然,我在这些步骤之间重新启动了Postfix和SASLAUTHD。
我也尝试重新启动系统,但没有任何改变。
如果有人会这么善良,帮我设置这个或得到一个脚本,这将是伟大的!
如果有人得到同样的错误,这也许可以节省您的search时间。
为了使用sasldb,你需要把文件/etc/default/saslauthd的MECHANISMS="pam"行改为MECHANISMS="sasldb" ,这就是我错过的。
然后重新启动saslauthd和后缀,并使用上面的configuration。