你的位置:首页 > Linux系统
下载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 username@gmail.com tls_certcheck off auth login user username@gmail.com 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 "测试邮件主题" username@domain.com
tail -f /usr/local/msmtp/msmtp.log 看看有没有成功,或者进入上面的邮箱看看是否收到邮件。
- 上一篇:shell脚本监控mysql服务器状态
- 下一篇:Apache 2.4.1 编译安装
发表评论: