Mar 2

centos6+msmtp+mutt实现SMTP发邮件 不指定

碟舞飞扬 , 00:25 , 服务器类 , 评论(0) , 引用(0) , 阅读(4546) , Via 本站原创 | |
下载msmtp软件,当前最新版1.4.27
http://downloads.sourceforge.net/project/msmtp/msmtp/1.4.27/msmtp-1.4.27.tar.bz2
1、编译软件
tar jxvf msmtp-1.4.27.tar.bz2
cd  msmtp-1.4.27
./configure --prefix=/usr/local/msmtp
make
make install
 
2、看一下配置文件在哪里
# /usr/local/msmtp/bin/msmtp --version
msmtp version 1.4.27
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 看看有没有成功,或者进入上面的邮箱看看是否收到邮件。
Tags: , ,
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]