armbian发送邮件:s-nail
实现命令行发邮件,使用163邮箱的SMTP。本文记录了部署过程。
安装s-nail
apt install s-nail
设置
nano /etc/s-nail.rc
在文件最后加上:
set [email protected]
set smtp=smtps://smtp.163.com:465
set smtp-auth=login
set [email protected]
set smtp-auth-password=此处不是邮箱密码,而是smtp服务提供的授权码!!!
发送测试邮件
echo "Successful" | s-nail -s "hello?" [email protected]
往[email protected]发送一个标题为hello?,正文是Successful。
输出:
root@onecloud:/etc# echo "Successful" | s-nail -s "hello?" [email protected]
s-nail: Warning: variable superseded or obsoleted: smtp
s-nail: Warning: variable superseded or obsoleted: smtp-auth-user
s-nail: Warning: variable superseded or obsoleted: smtp-auth-password
s-nail: The empty (default) command is ignored here, but has arguments: 1
s-nail: Obsoletion warning: please do not use *smtp*, instead assign a smtp:// URL to *mta*!
s-nail: Obsoletion warning: Use of old-style credentials, which will vanish in v15!
s-nail: Please read the manual section "On URL syntax and credential lookup"
添加附件echo "Successful" | s-nail -s "hello?" -a joke.txt [email protected]
虽然有警告,邮件还是发送出去了。
新设置
nano /etc/s-nail.rc
在文件最后加上:
set from="[email protected]"
set smtp-auth=login
set mta=smtps://user:[email protected]:465 #smtp服务器端口是465
set v15-compat #必须要
输出:
s-nail: The empty (default) command is ignored here, but has arguments: 1
邮件能正常发送。附件较大的邮件只能发送到163邮箱,发到QQ邮箱会被退信。163邮箱和QQ邮箱做为smtp服务器都需要授权码。