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
host smtp.126.com
user yangming0
from yangming0@126.com
password xxxxxxx (此处为126邮箱的授权码,若为公司邮箱,写正常公司邮箱密码)
auth login (此处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服务——短信验证码——设置授权码

转载于:https://blog.51cto.com/yangzhiming/2105501

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值