一、环境准备
#使用linux连接至网易邮箱的服务器(需要开启SMTP-设置授权码)发送至其他邮箱
163邮箱、qq邮箱
二、编写配置文件 /etc/mail.rc
set from = 邮箱地址
smtp = smtp.163.com
set smtp -auth-user = 邮箱账号
smtp-auth-password = 授权码
smtp-auth = login
保存退出
三、重启服务
systemctl restart postfix.service
echo "测试文件" | mail -s "主题" [邮箱地址]
发送文件格式
mail -s "fiel" [mail@xxx.com] </etc/hosts --文件的绝对路径
原文:https://www.cnblogs.com/tangdapang/p/12240467.html