#!/usr/bin/env python
# -*- coding: utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
sender = "[email protected]"
receiver = "[email protected]"
def send(content):
msg = MIMEMultipart()
#msg = MIMEText(" IP ", 'plain','gbk')
msg["from"] = sender
msg["to"] = receiver
msg["subject"] = content
txt = MIMEText("/* */", 'plain','gbk')
msg.attach(txt)
try:
smtpObj = smtplib.SMTP()
smtpObj.connect("smtp.yyy.com", "25")
state = smtpObj.login(sender, " ")
if state[0] == 235:
smtpObj.sendmail(msg["from"], msg["to"], msg.as_string())
print " "
smtpObj.quit()
except smtplib.SMTPException, e:
print str(e)