下载msmtp或者mpop(和msmtp一样小巧的邮件软件,不在这里写过程了。)软件,当前最新版1.4.30
http://jaist.dl.sourceforge.net/project/msmtp/msmtp/1.4.30/msmtp-1.4.30.tar.bz2
1、编译软件
tar jxvf msmtp-1.4.30.tar.bz2
cd  msmtp-1.4.30
./configure --prefix=/usr/local/msmtp
make
make install

2、看一下配置文件在哪里
# /usr/local/msmtp/bin/msmtp --version
msmtp version 1.4.30
Platform: x86_64-unknown-linux-gnu
TLS/SSL library: OpenSSL
Authentication library: built-in
Supported authentication methods:
plain cram-md5 external login
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/local/msmtp/share/locale
Keyring support: none
System configuration file name: /usr/local/msmtp/etc/msmtprc#默认配置文件的路径
User configuration file name: /root/.msmtprc

Copyright (C) 2012 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License
There is NO WARRANTY, to the extent permitted by law.

3、msmtp的配置文件
mkdir -p  /usr/local/msmtp/etc
touch /usr/local/msmtp/msmtp.log

vi /usr/local/msmtp/etc/msmtprc
输入以下内容
defaults
logfile /usr/local/msmtp/msmtp.log
account gmail
tls on
host smtp.gmail.com
port 587
from [email protected]
tls_certcheck off
auth login
user [email protected]
password password
account default : gmail

4、配置mutt
一般系统已经安装了,如果没有安装的话请使用 yum install mutt 安装
# tail -5 /etc/Muttrc
#vi /etc/Muttrc.local

set sendmail="/usr/local/msmtp/bin/msmtp"
set realname="测试服务器"
set use_from="yes"
set charset="UTF-8"
set editor="vi"

5、测试一下发送邮件
#echo "测试邮件内容" | mutt -s "测试邮件主题" [email protected]
tail -f /usr/local/msmtp/msmtp.log 看看有没有成功,或者进入上面的邮箱看看是否收到邮件。