msmtp+mutt部署札记

一、安装配置msmtp
cd /opt
wget http://downloads.sourceforge.net/msmtp/msmtp-1.4.32.tar.bz2
cd `tar jxvf msmtp-1.4.32.tar.bz2`
./configure –prefix=/usr/local/msmtp
make && make install
cd /usr/local/msmtp
mkdir etc
mkdir /var/log/msmtp
cat << EOF >> /usr/local/msmtp/etc/msmtprc
# Set default values for all following accounts.
defaults
logfile /var/log/msmtp/msmtp.log
# The SMTP server of the provider.
account sendmail
# SMTP邮件服务器地址
host mail.xxxxxx.com.cn
port 587
# 发送的邮件Email
from sendmail@xxxxxx.com.cn
auth on
tls on
tls_certcheck off
tls_starttls on
# 邮件服务器登录账号
user sendmail
# 邮件服务器登陆密码
password xxxxxx_PassWd
# Set a default account
account default : sendmail
EOF
chmod 600 etc/msmtprc

/usr/local/msmtp/bin/msmtp xxxxxxxx@163.com

输入任意字符,然后按Ctrl+D退出,查看邮件是否收到

二、安装配置mutt
yum install mutt
tail /etc/Muttrc
cat << EOF >> /etc/Muttrc.local
# Local configuration for Mutt.
set sendmail=”/usr/local/msmtp/bin/msmtp”
set use_from=yes
set realname=’sendmail@xxxxxx..com.cn’
set from=sendmail@xxxxxx..com.cn
set editor=”vim”
set charset=”utf-8″
set send_charset=”us-ascii:gb2312:gbk:utf-8″
EOF
测试邮件发送
/bin/echo `date` message– from `hostname` | mutt -s “date” xxxxxxxx@163.com

Print Friendly

发表评论

电子邮件地址不会被公开。 必填项已用*标注