跳转至

linux mutt 与 msmtp 配合发送邮件 可发附件

安装软件包 写入配置文件 在 /root 目录下创建 .msmtprc 在 /root 目录下创建 .muttrc 使用说明 内容可以换行,应该可以配合 cat 命令用 可以带附件发送 发送效果 参考来源 https://blog.csdn.net/qq_41376740/article/details/8057808

安装软件包

apt-get -y install mutt msmtp

写入配置文件

在 /root 目录下创建 .msmtprc

account default

host smtp_server_address
port 465
protocol smtp
from your_email@address.com
auth on
tls on
user your_email@address.com
password your_email_passwd
tls_starttls off

在 /root 目录下创建 .muttrc

set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="your_email@address.com"
set from="your_email@address.com"
set envelope_from=yes

使用说明

echo "内容" | mutt -s "标题" 收件地址

内容可以换行,应该可以配合 cat 命令用

root@tencent:~# echo "content1
> content2
> content3" | mutt -s "title" xxx@outlook.com

可以带附件发送

echo "内容" | mutt -s "标题" 收件地址 -a "文件绝对位置"

发送效果

参考来源

https://blog.csdn.net/qq_41376740/article/details/80578087 https://manpages.debian.org/unstable/msmtp/msmtp.1.en.html