sqtsqt 发表于 2019-2-19 09:01:02

Ubuntu使用mutt+msmtp发邮件

  Ubuntu使用mutt+msmtp发邮件
apt-get install mutt
apt-get install msmtp
cp -rv /etc/Muttrc ~/.muttrc
vi ~/.muttrc(最后添加)
  set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="yangming0"
set from=yangming0@126.com
set envelope_from=yes
:wq
vi ~/.msmtprc
  account default
hostsmtp.126.com
useryangming0
fromyangming0@126.com
password xxxxxxx   (此处为126邮箱的授权码,若为公司邮箱,写正常公司邮箱密码)
authlogin    (此处auth模式要根据邮箱服务器支持的方式来写)
tls   off
logfile ~/.msmtp.log
:wq
  查看邮箱服务器端支持的协议:
msmtp --host=smtp.126.com --serverinfo --port 25
echo "hello" | mutt -s "title" ming.yang@ming.com
  发送多人:
echo "hello" | mutt -s "title" ming.yang@ming.com ming.yang2@ming.com
  抄送邮件:
echo "hello" | mutt -s "title" ming.yang@ming.com -c ming.yang2@ming.com
  密送邮件:
echo "hello" | mutt -s "title" ming.yang@ming.com -b ming.yang2@ming.com
  发送附件:
echo "hello" | mutt -s "title" ming.yang@ming.com -a /var/aa.txt
  附:
  126邮箱授权码:
  登录126邮箱,设置——POP3/SMTP/IMAP——勾选POP3/SMTP服务——短信验证码——设置授权码



页: [1]
查看完整版本: Ubuntu使用mutt+msmtp发邮件