flask使用网易邮箱验证(Flash uses Netease mailbox authentication)

————恢复内容开始————

创建Config.py配置文件,在Config里添加网易邮箱的配置

SECRET_KEY = 'ztlnb'
    MAIL_SERVER = 'smtp.163.com'  # 电子邮件服务器的主机名或IP地址
    MAIL_PORT = '25'  # 电子邮件服务器的端口
    MAIL_USE_TLS = True  # 启用传输层安全
    MAIL_USERNAME = 'ztlman12@163.com'  # os.environ.get('MAIL_USERNAME') #邮件账户用户名
    MAIL_PASSWORD = 'HYGGFWOQHGJIXTKP'  # os.environ.get('MAIL_PASSWORD'

封装方法下次直接调用

def send_email(title, email, content):#传入标题,收件人,内容    mail = Mail(app)    msg = Message(title, sender='ztlman12@163.com', recipients=[email])  # 发件人,收件人    msg.html = content    mail.send(msg)

————恢复内容结束————

————————

————Restore content start————

Create config Py configuration file and add the configuration of Netease mailbox in config

SECRET_KEY = 'ztlnb'
    MAIL_SERVER = 'smtp.163.com'  # 电子邮件服务器的主机名或IP地址
    MAIL_PORT = '25'  # 电子邮件服务器的端口
    MAIL_USE_TLS = True  # 启用传输层安全
    MAIL_USERNAME = 'ztlman12@163.com'  # os.environ.get('MAIL_USERNAME') #邮件账户用户名
    MAIL_PASSWORD = 'HYGGFWOQHGJIXTKP'  # os.environ.get('MAIL_PASSWORD'

Encapsulate the next direct call of the method

def send_email(title, email, content):#传入标题,收件人,内容    mail = Mail(app)    msg = Message(title, sender='ztlman12@163.com', recipients=[email])  # 发件人,收件人    msg.html = content    mail.send(msg)

————End of recovery————