Centos7 Mutt安装配置

centos7 mutt安装配置

安装配置sendmail

1
2
sudo yum install -y sendmail
yum install -y sendmail-cf
  • vi /etc/mail/sendmail.mc

    1
    DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')
    1
    m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  • vi /etc/mail.rc末尾加入

    1
    2
    3
    4
    5
    6
    7
    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

    1
    echo 'it is only a test' | mail -s "test eamil"  hgliu@gaojihealth.com

mutt安装配置

  • 安装mutt
    1
    2
    yum -y install mutt
    yum install msmtp
  • cp /etc/Muttrc ~/.muttrc
  • vi ~/.muttrc末尾加入
    1
    2
    3
    4
    5
    6
    # 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
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    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发送
    1
    echo "test " | mutt   hgliu@gaojihealth.com  -s "test 01"

可能出现的问题

  • msmtp问题超照msmtp -P