zabbix告警使用sendEmail

1sendmail介绍

详细介绍见官网:http://caspian.dotconf.net/menu/Software/SendEmail/

2使用sendEmail

sendEmail是个十分优秀的发邮件的小工具,比起sendmail强了百倍,我在本地测试zabbix报警的时候,刚开始使用的是sendmail来发送邮件,在测试过程中发现,有时候死活收不到邮件,有时候收到邮件了,但是延迟特别大,要么在垃圾箱里面,很是苦恼.

所以我最后使用了sendEmail工具,感觉特别好用。只要配置正确,邮件就能够及时到达。不说了。直接进入正题

安装:

1  wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz //下载1.56版本
2 tar -xzvf sendEmail-v1.56.tar.gz //解压后就可以使用了
3 mv sendEmail /usr/local/bin/

一个实例:

1 /usr/local/bin/sendEmail -f [发送者地址] -t "接收者" -s [你的smtp服务器地址] -u "发送的主题" -xu [smtp验证登陆名(邮箱名字)] -xp [你在后台获取的登录密码(一般不是邮箱密码)] -m "邮件内容"
2 实例
3 /usr/local/bin/sendEmail -f 5712xx@qq.com -t 18387xxx@139.com -s smtp.qq.com -u "我是主题" -o message-charset=utf-8  -xu 5712xx@qq.com -xp airjyrcdzjtbbdbf -m "我是邮 件内容"

简单说下“  -xp [你在后台获取的登录密码(一般不是邮箱密码) ”哪里获取     以qq邮箱为例

第一步:进入qq邮箱,点击设置,然后账户

第二步:点击开启

第三步:

最后:按照提示复制授权码

 

具体详细使用可以看帮助:

 1 [root@iZ940ao463eZ alertscripts]# /usr/local/bin/sendEmail help
 2 Oct 20 22:40:56 iz940ao463ez sendEmail[29186]: Error: "help" is not a recognized option!
 3 
 4 sendEmail-1.56 by Brandon Zehm <caspian@dotconf.net>
 5 
 6 Synopsis:  sendEmail -f ADDRESS [options]
 7 
 8   Required:
 9     -f ADDRESS                from (sender) email address
10     * At least one recipient required via -t, -cc, or -bcc
11     * Message body required via -m, STDIN, or -o message-file=FILE
12 
13   Common:
14     -t ADDRESS [ADDR ...]     to email address(es)
15     -u SUBJECT                message subject
16     -m MESSAGE                message body
17     -s SERVER[:PORT]          smtp mail relay, default is localhost:25
18 
19   Optional:
20     -a   FILE [FILE ...]      file attachment(s)
21     -cc  ADDRESS [ADDR ...]   cc  email address(es)
22     -bcc ADDRESS [ADDR ...]   bcc email address(es)
23     -xu  USERNAME             username for SMTP authentication
24     -xp  PASSWORD             password for SMTP authentication
25 
26   Paranormal:
27     -b BINDADDR[:PORT]        local host bind address
28     -l LOGFILE                log to the specified file
29     -v                        verbosity, use multiple times for greater effect
30     -q                        be quiet (i.e. no STDOUT output)
31     -o NAME=VALUE             advanced options, for details try: --help misc
32         -o message-content-type=<auto|text|html>
33         -o message-file=FILE         -o message-format=raw
34         -o message-header=HEADER     -o message-charset=CHARSET
35         -o reply-to=ADDRESS          -o timeout=SECONDS
36         -o username=USERNAME         -o password=PASSWORD
37         -o tls=<auto|yes|no>         -o fqdn=FQDN
38 
39 
40   Help:
41     --help                    the helpful overview you're reading now
42     --help addressing         explain addressing and related options
43     --help message            explain message body input and related options
44     --help networking         explain -s, -b, etc
45     --help output             explain logging and other output options
46     --help misc               explain -o options, TLS, SMTP auth, and more

你喜欢的话试试吧,极力推荐,不要再使用sendmail了

posted @ 2016-10-20 22:51  Dicky_Zhang  阅读(4760)  评论(7编辑  收藏  举报