标签:mail.py
#!/usr/bin/python
#coding:utf8
import sys
import smtplib
from email.mime.text import MIMEText
def SendMail(*args):
content=args[3]
mailto_list=[args[1]]
mail_host="192.168.82.97"
mail_user="webmaster"
mail_pass="webmaster"
mail_postfix="pingan.com"
msg=MIMEText(content,_subtype=‘plain‘,_charset=‘gb2312‘)
msg[‘Subject‘]=args[2]
msg[‘From‘]="webmaster@papay.com"
msg[‘To‘]=";".join(mailto_list)
me="webmaster@papay.com"
try:
server=smtplib.SMTP()
server.connect(mail_host)
server.login(mail_user,mail_pass)
server.sendmail(me,mailto_list,msg.as_string())
server.close()
except Exception,e:
print str(e)
if __name__ == ‘__main__‘:
# print sys.argv
SendMail(*sys.argv)
标签:mail.py
原文地址:http://8561563.blog.51cto.com/8551563/1967734