Ubuntu 16.04.3 LTS 下通过mail发送qq邮件

根据网上的教程,修改/etc/s-nail.rc中来添加外部SMTP服务器如下:

set [email protected]
set smtp="smtp.qq.com"
set smtp-auth=login
set [email protected]
set smtp-auth-password=<授权码>

尝试发送

echo "nihao" | mail -s "test" [email protected]
提示出错(没有使用ssl):

smtp-server: 530 Error: A secure connection is requiered(such as ssl). 

More information at http://service.mail.qq.com/cgi-bin/help?id=28

"/home/sean/dead.letter" 8/186
... message not sent

查询相关资料后,发现

set smtp="smtp.qq.com"

应该改为

set smtp="smtps://smtp.qq.com:465"

注意前面的“smtps://” 以及后面的端口,都不能少,执行

echo "nihao" | mail -s "test" [email protected]

发送成功。



注:

文中的<授权码>,对于qq邮箱来说,需要登录网页qq邮箱,开启设置选项中的POP3/SMTP服务或者IMAP/SMTP服务,点击下方的 生成授权码 ,通过发送短信获得。如下图:

Ubuntu 16.04.3 LTS 下通过mail发送qq邮件_第1张图片




你可能感兴趣的:(软件应用)