email.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:wank.party 作者: Streetwalrus 项目源码 文件源码
def send_reset(user):
    if _cfg("smtp-host") == "":
        return
    smtp = smtplib.SMTP_SSL(_cfg("smtp-host"), _cfgi("smtp-port"))
    smtp.ehlo()
    smtp.login(_cfg("smtp-user"), _cfg("smtp-password"))
    with open("emails/reset") as f:
        message = MIMEText(html.parser.HTMLParser().unescape(\
            pystache.render(f.read(), {
                'user': user,
                "domain": _cfg("domain"),
                "protocol": _cfg("protocol"),
                'confirmation': user.passwordReset
            })))
    message['Subject'] = "Reset your wank.party password"
    message['From'] = _cfg("smtp-user")
    message['To'] = user.email
    smtp.sendmail(_cfg("smtp-user"), [ user.email ], message.as_string())
    smtp.quit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号