前提:登录163邮箱,在设置中获取客户端授权码
1. 安装软件
sudo apt-get install msmtp
sudo apt-get install mutt
2. 配置msmtp
touch ~/.msmtplog
vi ~/.msmtprc
account default
host smtp.163.com
user xxx
from xxx@163.com
password 网易邮箱客户端授权码
auth login
tls off
logfile ~/.msmtp.log
chmod 600 ~/.msmtprc
测试:msmtp --host=smtp.163.com --serverinfo
3.配置mutt
cp /etc/Muttrc ~/.muttrc
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="xxxxx"
set from=xxx@163.com
set envelope_from=yes
测试: echo "hello world" | mutt -s "title" xxx@qq.com 或使用 mutt交互式命令发送邮件