使用smtplib.SMTP_SSL发送邮件
msg:需要发送的html数据
message = MIMEText(msg, ‘html’, ‘utf-8’):设置发邮件内容msg、类型是html、编码是utf-8
message[‘From’] = Header(“测试”):设置发送人文本
message[‘To’] = Header(“测试负责人”):设置接收人文本
message[‘Subject’] = Header(‘测试报告’, ‘utf-8’):设置邮件主题
smtp = smtplib.SMTP_SSL(host, port):SMTP_SSL方式连接邮件服务器,host为smtp.qq.com,port为465
smtp.login(sender, password):登录发送人邮箱,sender发送人邮箱号
password:第三方登录QQ邮箱时,需要开启SMTP服务,获取授权码,此处password就填写生成的授权码
smtp.sendmail(sender, receivers, message.as_string(