#!/usr/bin/python
#decoding=utf-8
import sys
import smtplib
reload(sys)
sys.setdefaultencoding('utf-8')
print 'Content-Type: text/html;charset=utf-8\r\n'
from email.mime.text import MIMEText
login_user="user"//账户
login_passwd="passwd"//密码
smtp_connect="smtp.qq.com"//连接,如果是163邮箱,则为163.com
msg = MIMEText('mail_content')
msg['From'] = sender
msg['To'] = receivers
msg['Subject'] = 'mail_test'
smtp.login(login_user, login_passwd)
smtp.sendmail(sender, receivers, msg.as_string())
smtp.quit()
#decoding=utf-8
import sys
import smtplib
reload(sys)
sys.setdefaultencoding('utf-8')
print 'Content-Type: text/html;charset=utf-8\r\n'
from email.mime.text import MIMEText
sender="****"//发件人的邮箱
receivers="****"//收件人的邮箱login_user="user"//账户
login_passwd="passwd"//密码
smtp_connect="smtp.qq.com"//连接,如果是163邮箱,则为163.com
msg = MIMEText('mail_content')
msg['From'] = sender
msg['To'] = receivers
msg['Subject'] = 'mail_test'
smtp = smtplib.SMTP()
smtp.connect(smtp_connect)smtp.login(login_user, login_passwd)
smtp.sendmail(sender, receivers, msg.as_string())
smtp.quit()