1.安装mutt,msmtp

sudo apt-get install -y mutt msmtp

2.配置muttrc

set sendmail=”/usr/bin/msmtp”

set use_from=yes set realname=”xxxx”

 

set sendmail="/usr/bin/msmtp"

set use_from=yes

set realname="xxxxxxx"

set [email protected] //设置发邮件的账号 

set envelope_from=yes

3.编辑~/.msmtprc

 

account default

host smtp.163.com //发邮件服务器

from [email protected]  //读取账号

auth login

user xxxxx //登陆账号

password xxxxx //登陆密码

logfile ~/.msmtp.log //日志文件

4.测试

echo "this is test"|mutt -s "test" [email protected] //发送邮件到[email protected]