centos7 mutt安装配置

centos7 mutt安装配置

安装配置sendmail

sudo yum install -y sendmail
yum install -y sendmail-cf
  • vi /etc/mail/sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  • vi /etc/mail.rc末尾加入
set nss-config-dir=/etc/pki/nssdb
set ssl-verify=ignore
set smtp=smtps://smtp.exmail.qq.com:465
set smtp-auth=login
set smtp-auth-user=service-alert@gaojihealth.com
set smtp-auth-password=Gaoji_001#
set from=service-alert@gaojihealth.com
  • 测试sendmail
echo 'it is only a test' | mail -s "test eamil"  hgliu@gaojihealth.com

mutt安装配置

  • 安装mutt
yum -y install mutt
yum  install msmtp
  • cp /etc/Muttrc ~/.muttrc
  • vi ~/.muttrc末尾加入
# add
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="service-alert@gaojihealth.com"
set editor="vim"
set from="service-alert@gaojihealth.com"
  • 确认msmtp命令路径正确存在
  • 配置msmtp
  • vi ~/.msmtprc
host smtp.exmail.qq.com
port 465
from service-alert@gaojihealth.com
auth login
tls_starttls off
tls on
tls_certcheck off
user service-alert@gaojihealth.com
password Gaoji_001#
logfile ~/.msmtp.log
  • 测试mutt发送
 echo "test " | mutt   hgliu@gaojihealth.com  -s "test 01"

可能出现的问题

  • msmtp问题超照msmtp -P