本文整理汇总了Python中flask_mail.Mail.send_message方法的典型用法代码示例。如果您正苦于以下问题:Python Mail.send_message方法的具体用法?Python Mail.send_message怎么用?Python Mail.send_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_mail.Mail
的用法示例。
在下文中一共展示了Mail.send_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MongoEngine
# 需要导入模块: from flask_mail import Mail [as 别名]
# 或者: from flask_mail.Mail import send_message [as 别名]
app.config['MAIL_PASSWORD'] = mail_pass
app.config['MAIL_SUPPRESS_SEND'] = False
# Create database connection object
db = MongoEngine(app)
#Bootstrap
Bootstrap(app)
#Setup Mail
mail = Mail(app)
mail.init_app(app)
# mail test
with mail.record_messages() as outbox:
mail.send_message(subject='testing',
body='test',
recipients=['[email protected]'])
assert len(outbox) == 1
assert outbox[0].subject == "testing"
# Setup Flask-Security
user_datastore = MongoEngineUserDatastore(db, User, Role)
security = Security(app, user_datastore, confirm_register_form=ExtendedConfirmRegisterForm)
#security = Security(app, user_datastore)
@app.route('/')
def index():
return render_template('index.html')