import re #匹配邮箱,检验是否正确
import smtplib #发送邮箱
from email.header import Header #设置邮箱头信息
from email.mime.text import MIMEText #设置邮箱内容
class Send_EMail():
#服务器
Smtp_Server = "smtp.qq.com"
#授权码(在QQ空间获取到的授权码)
License_Key = "×××××××××××××"
def __init__(self,Send_Mail,Receive_Mail,Title,content):
#发件人
self.Send_Mail = Send_Mail
#收件人
self.Receive_Mail = Receive_Mail
#邮箱标题
self.Title = Title
#邮箱内容
self.content = content
#正文设置,第一个参数为内容,第二个参数为内容格式,第三个参数是编码格式
self.Email = MIMEText(content,"plain","utf-8")
self.Email["From"] = Header(Send_Mail)
self.Email["To"] = Header(Receive_Mail)
self.Email["Subject"] = Header(Title)
def Send(self):
#开启服务,使用SSL加密传输
server = smtplib.SMTP_SSL(self.Smtp_Server)
server.connect(self.Smtp_Server,465)
#登陆
server.login(self.Send_Mail, self.License_Key)
#发送
server.sendmail(self.Send_Mail, self.Receive_Mail, self.Email.as_string())
#关闭服务
server.quit()
if __name__ == "__main__":
while(True):
Send_Mail = input("请输入发件人QQ邮箱:")
#检验邮箱
if not re.compile(r"^[1-9][0-9]{4,10}@qq.com").match(Send_Mail):
print("格式错误···请重新输入···")
continue
break;
while(True):
Receive_Mail = input("请输入收件人QQ邮箱:")
#检验邮箱
if not re.compile(r"^[1-9][0-9]{4,10}@qq.com").match(Receive_Mail):
print("格式错误···请重新输入···")
continue
break;
Title = input("请输入发送的邮箱标题:")
content = input("请输入发送的邮箱内容:")
SE = Send_EMail(Send_Mail,Receive_Mail,Title,content)
SE.Send()
问题 在响应式布局中,我们应该小心对待iframe元素,iframe元素的width和height...
1 Android屏幕适配相关概念 1.1 屏幕尺寸(Screen Size) 屏幕尺寸是屏幕的对角线...
本文实例讲述了YII2框架中日志的配置与使用方法。分享给大家供大家参考,具体如...
HTML 代码中的所有连续的空格或空行(换行)都会被显示为一个空格。 例子1:(文...
Redis 在微博内部分布在各个应用场景,比如像现在春晚必争的红包飞活动,还有像...
本文实例为大家分享了小程序实现上下切换位置的具体代码,供大家参考,具体内容...
正则表达式快速入门(二) 【导读】在本文里,我们主要介绍子模式(subpatterns)...
数据库的存储引擎是数据库的底层软件组件,数据库管理系统使用数据库引擎进行增...
3月17日消息 外媒 Windows Latest 报道,大家可能已经知道,Windows 10 目前预装...
前言 爬虫和反爬虫日益成为每家公司的标配系统。 爬虫在情报获...