|
import smtplib
#from email.mime.text import MIMEText
from email.MIMEText import MIMEText
def send_email(content):
sender = "lgl15984@163.com"
receiver = [xxx@qq.com]
host = '220.181.12.16'
port = 465
msg = MIMEText(content)
msg['From'] = "lgl15984@163.com"
msg['To'] = "xxxx@qq.com"
msg['Subject'] = "backup check"
try:
smtp = smtplib.SMTP()
smtp.connect('220.181.12.16:25')
# smtp.ehlo()
# smtp.starttls()
# smtp.ehlo()
# smtp = smtplib.SMTP_SSL(host, port)
smtp.login(sender, 'xxxx')
smtp.sendmail(sender, receiver, msg.as_string())
# getlog().info("send email success")
except Exception, e:
# get_log().error(e)
print 'email fail'
print e
pass
send_email('aaa')
|
|
|