本文整理汇总了Python中envelopes.Envelope.add_header方法的典型用法代码示例。如果您正苦于以下问题:Python Envelope.add_header方法的具体用法?Python Envelope.add_header怎么用?Python Envelope.add_header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类envelopes.Envelope
的用法示例。
在下文中一共展示了Envelope.add_header方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_password_restore_ref
# 需要导入模块: from envelopes import Envelope [as 别名]
# 或者: from envelopes.Envelope import add_header [as 别名]
def send_password_restore_ref(email, name, token):
envelope = Envelope(
from_addr=(u'[email protected]', u'PromTal'),
to_addr=(email, name),
subject=u'Восстановление пароля',
# text_body=render_template('email/password_restore.html', token=token),
text_body=render_template_string(restore_password, token=token),
)
print(envelope)
envelope.add_header("Content-Type", "text/html")
gmail.send(envelope)
示例2: send_news_notification
# 需要导入模块: from envelopes import Envelope [as 别名]
# 或者: from envelopes.Envelope import add_header [as 别名]
def send_news_notification(news_id, news_title):
users = User.query.filter_by(news_notification=True).all()
for user in users:
envelope = Envelope(
from_addr=(u'[email protected]', u'PromTal'),
to_addr=(user.email, user.full_name),
subject=u'Новая новость',
# text_body=render_template('email/news_notification.html', id=news_id, title=news_title),
text_body=render_template_string(news_notification, id=news_id, title=news_title),
)
envelope.add_header("Content-Type", "text/html")
gmail.send(envelope)