python使用smtplib模块通过gmail发送邮件,pythonsmtplib,import smtpl
文章由Byrx.net分享于2019-03-23 07:03:52
python使用smtplib模块通过gmail发送邮件,pythonsmtplib,import smtpl
import smtplibfrom email.MIMEMultipart import MIMEMultipartfrom email.MIMEText import MIMETextfromaddr = 'fromaddr@gmail.com'toaddr = 'toaddr@gmail.com'text = 'test email message sent from Python code'username = 'fromaddruser'password = 'fromaddrpassword'msg = MIMEMultipart()msg['From'] = fromaddrmsg['To'] = toaddrmsg['Subject'] = 'Test'msg.attach(MIMEText(text))server = smtplib.SMTP('smtp.gmail.com:587')server.ehlo()server.starttls()server.ehlo()server.login(username, password)server.sendmail(fromaddr, toaddr, msg.as_string())server.quit()
相关内容
- python通过PIL缩放互联网上的图片并保存,,''' tk_image
- python中如果通过索引遍历列表,python索引遍列表,pytho
- python实现百分比和进度条,python百分比,import os,sy
- Python shelve简单数据存储代码片段,,#!/usr/bin/p
- 使用python获取城市经纬度,python获取经纬度,python2 环境
- Python unicode码转utf8,pythonutf8,Python unico
- 寻找时间点,时间,任务需要每隔五分钟执行一
- 下载360最新的安装包,下载360安装包,从360官网上下载最
- Python的logging模块封装,pythonlogging模块,使得logging模块用
- 排序,,q = lambda x
评论关闭