Ubuntu需要安装以下软件包
sudo apt-get install ca-certificates
公司moregg.com用的是gmail的企业邮箱
配置 msmtp
安装完后,编辑 msmtp 配置文件 /usr/local/etc/msmtprc
defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
#Ubuntu使用下面这行配置
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
account default
host smtp.gmail.com
port 25
auth on
user zabbix@moregg.com
password zabbixzabbix
from zabbix@moregg.com
logfile /tmp/msmtp.log
msmtp username@gmail.com
输入任意字符,然后按Ctrl+D退出,查看邮件是否收到.可以查看 logfile 里面的发送日志记录.
配置mutt
vim ~/.muttrc
set sendmail="/usr/local/bin/msmtp"
set use_from=yes
set realname="Zabbix"
set from=zabbix@moregg.com
set envelope_from=yes
set editor="vim"
echo Hello |mutt -s hello xingru.li@moregg.com
转载于:https://blog.51cto.com/kamui0523/1715254