本文整理汇总了Python中flaskext.mail.Message.get_response方法的典型用法代码示例。如果您正苦于以下问题:Python Message.get_response方法的具体用法?Python Message.get_response怎么用?Python Message.get_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flaskext.mail.Message
的用法示例。
在下文中一共展示了Message.get_response方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cc
# 需要导入模块: from flaskext.mail import Message [as 别名]
# 或者: from flaskext.mail.Message import get_response [as 别名]
def test_cc(self):
msg = Message(
subject="testing", recipients=["[email protected]"], body="testing", cc=["[email protected]"]
)
response = msg.get_response()
self.assertIn("Cc: [email protected]", str(response))
示例2: run
# 需要导入模块: from flaskext.mail import Message [as 别名]
# 或者: from flaskext.mail.Message import get_response [as 别名]
def run(self, testing):
mail = Mail(app)
for user, csv_reports in generate_reports(app.config["REPORTS_DIR"]):
context = {"user": user}
template = Template(app.config["EMAIL_TEXT_TEMPLATE"])
msg = Message(app.config["EMAIL_SUBJECT_LINE"],
recipients=[user.alternate_email] if user.use_alternate_email else [user.email],
sender=app.config["DEFAULT_MAIL_SENDER"])
msg.body = template.render(context)
for csv_filename, csv_data in csv_reports:
msg.attach(csv_filename, "text/csv", csv_data)
if not testing:
mail.send(msg)
else:
print msg.get_response().to_message().as_string()
示例3: test_bcc
# 需要导入模块: from flaskext.mail import Message [as 别名]
# 或者: from flaskext.mail.Message import get_response [as 别名]
def test_bcc(self):
msg = Message(subject="testing",
recipients=["[email protected]"],
body="testing",
bcc=["[email protected]"])
response = msg.get_response()
assert "Bcc: [email protected]" in str(response)
示例4: test_reply_to
# 需要导入模块: from flaskext.mail import Message [as 别名]
# 或者: from flaskext.mail.Message import get_response [as 别名]
def test_reply_to(self):
msg = Message(
subject="testing",
recipients=["[email protected]"],
sender="spammer <[email protected]>",
reply_to="somebody <[email protected]>",
body="testing",
)
response = msg.get_response()
self.assertIn("Reply-To: somebody <[email protected]>", str(response))
示例5: get_response
# 需要导入模块: from flaskext.mail import Message [as 别名]
# 或者: from flaskext.mail.Message import get_response [as 别名]
def get_response(self):
response = BaseMessage.get_response(self)
response["Date"] = datetime.utcnow().strftime(
'%a, %d %b %Y %H:%M:%S +0000'
).strip()
return response