zabbix群里一网友在安装msmtp+mutt测试发送邮件失败
配置文件如下:
/usr/local/msmtp/etc/msmtprc
account default host smtp.163.com port 25 from xxxxx@163.com auth login tls off user xxxxx@163.com password xxxxx logfile /var/log/mmlog
测试发送的时候报错:
[root@localhost etc]# /usr/local/msmtp/bin/msmtp sssss@qq.com msmtp: envelope from address xxxxx@163.com not accepted by the server msmtp: server message: 553 You are not authorized to send mail, authentication is required fc58b17c-e07a-46ed-9353-d4bc7a49d131 msmtp: could not send mail (account default from /usr/local/msmtp/etc/msmtprc)
详细的日志错误/var/log/mmlog
Apr 10 02:10:01 host=smtp.163.com tls=off auth=on user=xxxxx@163.com from=xxxxx@163.com recipients=sssss@qq.com smtpstatus=535 smtpmsg='535 authentication failed cd2f44bd-e422-4831-9a96-fecd6a1f1272' errormsg='authentication failed (method LOGIN)' exitcode=EX_NOPERM
网页端测试登录正常,后来我换了自己的163账号重新测试msmtp发现发送正常,想来肯定是网友的163账号设置出了问题。
终于让我查到了原因
再来看看http://help.mail.163.com/faqDetail.do?code=d7a5dc8471cd0c0e8b4b8f4f8e49998b374173cfe9171305fa1ce630d7f67ac24a2130dd2fad05b1
客户端授权码使用规则
1.设置授权码后,邮箱客户端无法通过邮箱密码登录,只能通过授权码来登录邮箱客户端。Web(网页) 端仍可使用邮箱密码登录。
2.设置授权码后,IMAP/POP3/SMTP共用这一个授权码。
3. 为了保护您的邮箱帐号和数据安全,一旦关闭授权码, 将同时关闭 IMAP/POP3/SMTP 功能,
原有授权密码全部失效,您不可通过邮箱密码在客户端直接登录邮箱。
当您关闭所有IMAP/POP3/SMTP 这3个服务协议,就联动关闭授权码功能;
只要有任意一个协议打开,仍然会保留授权码功能(能通过登录验证,不能使用已关闭的服务)
4. webmail设置页面开启IMAP/POP3/SMTP三项服务中任意一项时,需要同时开启授权码服务。
其实我是来吐槽这个功能的,原来我的邮箱账号开启了imap/pop3/smtp,但是在测试过程中把这三个服务关闭了,导致我的账号必须绑定一个手机号,还默认开通了手机163邮箱,原来欢乐地用邮箱密码登录foxmail,现在只能改用一串狗屎一样长的客户端授权码。
加强安全是好事,但这也太带强制性了,都没有回旋的余地。