标签:python 邮件告警
zabbix环境安装好后,用shell写了个邮件脚本测试都没有问题,就是不发邮件,后来写了个python的邮件替换上了,可以正常发送邮件了,不知道是zabbix不支持shell还是其他问题! #!/usr/bin/python import smtplib import string import sys HOST = "smtp.163.com" SUBJECT = sys.argv[2] TO = sys.argv[1] FROM = "zabbix@163.com" text = sys.argv[3] BODY = string.join(( "From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "", text ), "\r\n") server = smtplib.SMTP() server.connect(HOST,"25") server.starttls() server.login("zabbix@163.com","passwd") server.sendmail(FROM, [TO], BODY) server,quit()
标签:python 邮件告警
原文地址:http://kingtigerhu.blog.51cto.com/2936525/1597117