带有virtualmin和后缀的nodemailer
我使用虚拟分钟我有一个有效的电子邮件帐户[email protected]我可以通过webmin /虚拟分钟登录并发送电子邮件。
现在,我想使用nodemailer从node.js发送邮件。
顺便说一句,这也可以从命令行使用。
mail -s "testing email" [email protected] < /dev/null
这是我的nodemailer配置:
{
"smtp" : {
"host": "localhost",
"secure": false,
"auth": {
"user": "[email protected]",
"pass": "mypass"
},
"tls": {
"rejectUnauthorized": false
},
"debug" : true
},
"from" : "Resourceful Network <[email protected]>"
}
我在后缀配置文件中找到以下配置:
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may
全部由虚拟分钟设置。
我收到此错误
Error: Invalid login: 535 5.7.8 Error: authentication failed: authentication failure
code: 'EAUTH',
response: '535 5.7.8 Error: authentication failed: authentication failure',
responseCode: 535,
command: 'AUTH PLAIN'
我100%确定密码正确。
如果在nodemailer配置中设置"secure" : true
,则会出现此错误
errno: 'ECONNREFUSED',
code: 'ESOCKET',
syscall: 'connect',
address: '127.0.0.1',
port: 465,
所以这似乎不是要走的路。
不确定使用哪种登录协议。是否需要设置authMethod?安全还是不安全?
回答如下:我能够通过从nodemailer配置中删除身份验证来解决此问题。我现在意识到smtpd_recipient_restrictions = permit_mynetworks
意味着本地主机上的任何人都将被自动发送。而且仍然以某种方式提供了(正确的)用户名+密码,使事情绊倒了?