国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python利用QQ郵箱發送郵件的實現方法(分享)

2019-11-25 16:06:45
字體:
來源:轉載
供稿:網友

廢話不多說,直接上代碼

Python2.7

#!/usr/bin/env python2.7# -*- coding=utf-8 -*-import smtplibfrom email.mime.text import MIMEText_user = "648613081@qq.com"_pwd = "這里改成你的授權碼"_to  = "648613081@qq.com"msg = MIMEText("this is a email from python,ha ha ha ...")msg["Subject"] = "這里是主題"msg["From"] = _usermsg["To"] = _totry:  s = smtplib.SMTP_SSL("smtp.qq.com", 465)  s.login(_user, _pwd)  s.sendmail(_user, _to, msg.as_string())  s.quit()  print "發送成功"except s.smtplib.SMTPException, e:  print "發送失敗"

Python3.6

#!/usr/bin/env python3.6# -*- coding=utf-8 -*-import smtplibfrom email.mime.text import MIMEText_user = "648613081@qq.com"_pwd = "這里改成你的授權碼"_to  = "648613081@qq.com"msg = MIMEText("this is a email from python,ha ha ha ...")msg["Subject"] = "這里是主題"msg["From"] = _usermsg["To"] = _totry:  s = smtplib.SMTP_SSL("smtp.qq.com", 465)  s.login(_user, _pwd)  s.sendmail(_user, _to, msg.as_string())  s.quit()  print ("發送成功")except (s.smtplib.SMTPException, e):  print ("發送失敗")

以上這篇Python利用QQ郵箱發送郵件的實現方法(分享)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 珲春市| 始兴县| 尖扎县| 衡山县| 乡城县| 乌什县| 儋州市| 竹北市| 和平区| 莱芜市| 呼图壁县| 张家界市| 三原县| 澳门| 阜阳市| 洞头县| 昆山市| 乐安县| 康乐县| 襄汾县| 泰兴市| 共和县| 瑞金市| 鄂托克前旗| 兴国县| 梓潼县| 成都市| 宣化县| 忻城县| 元江| 宜兰市| 平昌县| 玉环县| 碌曲县| 子洲县| 龙海市| 兰考县| 天峨县| 普宁市| 新巴尔虎右旗| 新干县|