当前位置:   article > 正文

【python-flask】jinjia2 文档学习 &邮件发送

【python-flask】jinjia2 文档学习 &邮件发送

ref:https://docs.pythontab.com/jinja/jinja2/templates.html jinjia2的文档
ref:https://www.kancloud.cn/wizardforcel/flask-extension-docs/125988 flask的拓展文档
发送邮件设置:

    app.config['MAIL_SERVER'] = 'smtp.qq.com'
    app.config['MAIL_PORT'] = 465
    app.config['MAIL_USE_SSL'] = True
    app.config['MAIL_USE_TSL'] = False
    app.config['MAIL_USERNAME'] = '514422868@qq.com'
    app.config['MAIL_PASSWORD'] = 'sadsdada'
    app.config['MAIL_SUBJECT_PREFIX'] = '[鱼书]'
    app.config['MAIL_SENDER'] = '鱼书 <514422868@qq.com>'
	
	def send_mail(to, subject, template, **kwargs):
    # msg = Message("[鱼书]" + " " + subject, sender=
    #               recipients=["to@example.com"])
    #

    msg = Message("Hello",
                  sender="514422868@qq.com",
                  recipients=["514422868@qq.com"])
    return mail.send(msg)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号