import smtplib |
from email.mime.text import MIMEText |
from email.header import Header |
''' |
class Send_message: |
self.username='852969647@qq.com' |
self.password='noslhdhhgwfybddg' |
self.sender='852969647@qq.com' |
self.receivers=['852969647@qq.com','luowenxiang@tenda.cn'] |
def __init__(self): |
smtp = smtplib.SMTP() |
smtp.connect('smtp.qq.com',25) |
message = MIMEText('Python 邮件发送测试...', 'plain', 'utf-8') |
message['From'] = Header("菜鸟教程", 'utf-8') # 发送者 |
message['To'] = Header("测试", 'utf-8') # 接收者 |
subject = 'Python SMTP m20测试用例执行终止,问题复现!' |
message['Subject'] = Header(subject, 'utf-8') |
smtp.login(username, password) |
smtp.sendmail(sender,receivers, message.as_string()) |
smtp.quit() |
''' |
smtp = smtplib.SMTP() |
smtp.connect( 'smtp.qq.com' , 25 ) |
username = '852969647@qq.com' |
password = 'noslhdhhgwfybddg' |
sender = '852969647@qq.com' |
receivers = [ '852969647@qq.com' , 'luowenxiang@tenda.cn' ] |
message = MIMEText( 'Python 邮件发送测试...' , 'plain' , 'utf-8' ) |
message[ 'From' ] = Header( "菜鸟教程" , 'utf-8' ) # 发送者 |
message[ 'To' ] = Header( "测试" , 'utf-8' ) # 接收者 |
subject = 'Python SMTP m20测试用例执行终止,问题复现!' |
message[ 'Subject' ] = Header(subject, 'utf-8' ) |
smtp.login(username, password) |
smtp.sendmail(sender,receivers, message.as_string()) |
smtp.quit() |