Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: UTF-8 -*-
- import smtplib
- from email.MIMEText import MIMEText
- mailto_list = ['xenuhuhol@polyfaust.com', ]
- mail_host = "smtp.test.net"
- mail_user = "test-mail"
- mail_pass = "124qwrasf"
- mail_postfix = "8864.com"
- mail_file = open('e:\\TRACH\\1.txt', 'rb')
- mail_message = mail_file.read()
- def send_mail(to_list, sub, content):
- me = "phpchecker" + "<" + mail_user + "@" + mail_postfix + ">"
- msg = MIMEText(content, _subtype='plain', _charset='gb2312')
- msg['Subject'] = sub
- msg['From'] = me
- msg['To'] = ";".join(to_list)
- try:
- server = smtplib.SMTP()
- server.connect(mail_host, port=587)
- server.login(mail_user, mail_pass)
- server.sendmail(me, to_list, msg.as_string())
- server.close()
- return True
- except Exception, e:
- print str(e)
- return False
- send_mail(mailto_list, "Python_Check_Warning", mail_message)
- if __name__ == '__main__':
- if send_mail(mailto_list, "PHP_Check_Warning", mail_message):
- print "Success"
- else:
- print "Error"
- mail_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement