头像-63669

埋头敲代码

  • 四川省成都市
  • 单片机 嵌入式
  • 消费电子

个人成就

获得 0 次赞

帮助过1人

树莓派如何给QQ邮箱发送邮件..有人会吗

实例1 #coding:utf-8 import sys import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart def sendEmail(msgTo, content, type):     #(attachment,html) = content     msg = MIMEMultipart()     msg['Subject'] = type     msg['From'] = '1067302838@qq.com'     msg['To'] = msgTo       att = MIMEText(content,'plain', 'utf-8')     msg.attach(att)       try:         smtp = smtplib.SMTP()         smtp.connect('smtp.qq.com', 25)         smtp.login(msg['From'], 'password')         smtp.sendmail(msg['From'], msg['To'].split(','), msg.as_string())     except Exception,e:         print e if __name__ == '__main__':          ToUser='1067302838@qq.com'       sendEmail(ToUser,"qa", u'主题')