centos安装msmtp,利用gmail发送

所有步骤如下:

先下载安装包

wget http://hivelocity.dl.sourceforge.net/project/msmtp/msmtp/1.4.31/msmtp-1.4.31.tar.bz2
解压并安装,最后编辑配置文件
tar jxvf msmtp-1.4.31.tar.bz2
cd msmtp-1.4.31
./configure --prefix=/usr/local/msmtp
make && make install
cd /usr/local/msmtp
mkdir etc
cd etc
vim msmtprc
内容如下:
defaults
tls on
tls_starttls on
tls_trust_file /etc/pki/tls/certs/ca-bundle.crt

account default
host smtp.gmail.com
port 587
auth on
user yourmail
password yourpass
from yourmail
logfile /usr/local/msmtp/msmtp.log
最后调试(之后可以把debug选项去掉)
echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |/usr/local/msmtp/bin/msmtp --debug --from=default -t yourmail

你可能感兴趣的:(centos,Gmail,msmtp)