码迷,mamicode.com
首页 > 其他好文 > 详细

Zabbix利用msmtp+mutt发送邮件报警

时间:2016-05-31 12:10:27      阅读:704      评论:0      收藏:0      [点我收藏+]

标签:

技术分享 

[root@86 ~]# wget http://jaist.dl.sourceforge.net/project/msmtp/msmtp/1.4.32/msmtp-1.4.32.tar.bz2

 

百度网盘:http://pan.baidu.com/s/1o8w68ci

 

[root@86 msmtp-1.4.32]# pwd
/root/msmtp-1.4.32
[root@86 msmtp-1.4.32]# mkdir -p  /usr/local/msmtp/etc

[root@86 msmtp-1.4.32]#./configure --prefix=/usr/local/msmtp --with-ssl=openssl

 

[root@86 msmtp-1.4.32]# make && make install

 配置msmtp

[root@86 msmtp-1.4.32]# mkdir -p  /usr/local/msmtp/etc

 

vim  /usr/local/msmtp/etc/msmtprc
account default
host smtp.163.com //SMTP服务器
port 25
from clnking@163.com
auth login
tls off
user clnking //邮箱用户名 是clnking 而不是clnking@163.com
password xxxxxx #是授权码,而不是邮箱登录密码(授权码是用于登录第三方邮件客户端的专用密码)注意文章开头的图片
logfile /var/log/zabbix/msmtp.log //日志路径

 

测试msmtp

[root@86 msmtp-1.4.30]# /usr/local/msmtp/bin/msmtp lin.chen@xinxianm.com  (邮箱必须是 /usr/local/msmtp/etc 里配置的邮箱)所以下面会报错!!
hello
msmtp: the server did not accept the mail
msmtp: server message: 554 DT:SPM 163 smtp4,DtGowAAnErU7+ExXz+8hAQ--.9856S2 1464662088,please see http://mail.163.com/help/help_spam_16.htm?ip=123.57.36.227&hostid=smtp4&time=1464662088
msmtp: could not send mail (account default from /usr/local/msmtp/etc/msmtprc)

 

[root@86 msmtp-1.4.30]# /usr/local/msmtp/bin/msmtp clnking@163.com
kkkkkkkkkkkkk^[  
但信箱里没内容
cat /var/log/mmlog
May 31 10:47:00 host=smtp.163.com tls=off auth=on user=clnking from=clnking@163.com recipients=clnking@163.com mailsize=15 smtpstatus=250 smtpmsg=‘250 Mail OK queued as smtp4,DtGowADXJJQP+0xX0LciAQ--.5878S2 1464662820‘ exitcode=EX_OK

 因为没有配置:MUTT

[root@86 msmtp-1.4.32]# yum install mutt

 

[root@86 ~]# vi /etc/Muttrc
set sendmail="/usr/local/msmtp/bin/msmtp"
set use_from=yes
set editor="vim"
set realname="clnking@163.com"

[root@86 ~]# echo "test mail 2016 content tom2" |mutt -s "test kkkkk" clnking@163.com
进入邮箱  收到邮件 ------》测试成功!

 

Zabbix利用msmtp+mutt发送邮件报警

标签:

原文地址:http://www.cnblogs.com/bass6/p/5544265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!