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 [email protected]
set envelope_from=yes
:wq

vi ~/.msmtprc

account default
host smtp.126.com
user yangming0
from [email protected]
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" [email protected]

发送多人:

echo "hello" | mutt -s "title" [email protected] [email protected]

抄送邮件

echo "hello" | mutt -s "title" [email protected] -c [email protected]

密送邮件

echo "hello" | mutt -s "title" [email protected] -b [email protected]

发送附件:

echo "hello" | mutt -s "title" [email protected] -a /var/aa.txt

附:

126邮箱授权码:

登录126邮箱,设置——POP3/SMTP/IMAP——勾选POP3/SMTP服务——短信验证码——设置授权码

相关文章

ubuntu退出redis的示例:指定配置文件方式启动源码redis:roo...
ubuntu中mysql改密码忘了的解决方法:1.在终端中切换到root权...
ubuntu安装mysql失败的解决方法原因:可能是原有的MySQL还有...
使用centos和ubuntu建站的区别有以下几点1.CentOS是Linux发行...
ubuntu图形界面和字符界面切换的方法:可以通过快捷键CTRL+A...
ubuntu中重启mysql失败的解决方法1.首先,在ubuntu命令行中,...