CentOS6搭建msmtp+mutt邮件服务

    安装配置msmtp

    yum -y install gcc gcc-c++ gnutls gnutls-devel gnutls-utils openssl openssl-devel libidn libidn-devel
    wget http://sourceforge.net/projects/msmtp/files/msmtp/1.4.32/msmtp-1.4.32.tar.bz2
    tar -jxvf msmtp-1.4.32.tar.bz2
    cd msmtp-1.4.32
    ./configure --prefix=/usr/local/msmtp
    make && make install
    mkdir /usr/local/msmtp/etc

    生成配置文件

    nano /usr/local/msmtp/etc/msmtprc

    添加如下内容

    defaults
    tls on
    logfile /usr/local/msmtp/msmtp.log

    account acc1
    host smtp.qq.com
    port 465
    from 10000@qq.com
    auth login
    tls_starttls off
    tls on
    tls_certcheck off
    user 10000@qq.com
    password 12345678

    account default : acc1

    安装配置mutt

    yum -y install mutt

    编辑配置文件

    nano /etc/Muttrc

    在最后面添加如下内容

    set sendmail="/usr/local/msmtp/bin/msmtp"
    set use_from=yes
    set realname="10000@qq.com"
    set editor="vim"
    set from="10000@qq.com"

    测试邮件

    /usr/local/msmtp/bin/msmtp 100000@qq.com
    输入任意字符,然后按Ctrl+D退出,查看邮件是否收到。

    查看日志

    cat /usr/local/msmtp/msmtp.log

    利用MUTT发送邮件

    echo "这里是正文" |mutt -s "这里是标题" 10000@qq.com

    echo "邮件内容`date +%Y%m%d`" | mutt -a /home/文档.txt -s "邮件标题`date +%Y%m%d`" -- 10000@qq.com

    转载请注明:RAIN MAN » CentOS6搭建msmtp+mutt邮件服务

    喜欢 2
标签: ,

还没有人抢沙发呢~