Gmail 发信,gmail发信,Python语言: Gm
Gmail 发信,gmail发信,Python语言: Gm
Python语言: Gmail 发信
#coding:utf-8from email.mime.text import MIMETextimport smtplibclass Gamil (object ): def __init__ (self ,account,password): """ Gamil("zsp007","xxxx") """ self .account=" %s @gmail.com" %account self .password=password def send (self ,to,title,content): """ send('zsp007@gmail.com,zsp747@gmail.com") """ server = smtplib.SMTP('smtp.gmail.com' ) server.docmd("EHLO server" ) server.starttls() server.login(self .account,self .password) msg = MIMEText(content) msg['Content-Type' ]='text/plain; charset="utf-8"' msg['Subject' ] = title msg['From' ] = self .account msg['To' ] = to server.sendmail(self .account, to ,msg.as_string()) server.close()if __name__=="__main__" : gmail=Gamil("你的帐号" ,"你的密码" ) gmail.send("zsp007@gmail.com,zsp747@gmail.com" ,"你好,测试一下" ,"好好学习,天天向上" )
相关内容
- Python 将DOC word文档转换为PDF,,下面代码只能在windo
- python遍历目录树代码,python历目录树,from os.path
- Python 发email 带附件,python发email附件,Python 发emai
- python的日志logging模块使用总结,pythonlogging,1.简单的将
- python 判断操作系统类型代码,python操作系统,有时候需
- 使用python生成随机密码的例子,python生成例子,import r
- python将字符串转换为字节数组,python数组,#!/usr/bin/p
- python 获取mac地址的两种方法,pythonmac,(1)通用方法
- python计算数组、元祖等列表元素的和,python数组,print
- python里简洁的条件语句写法替代?表达式,python写法,a
评论关闭