在我的项目中,我必须发送一封电子邮件并将值传递到html代码中。我试试这个:
l_sender = []
l_sender.append('mario.rossi@test.com')
emailsend(l_sender)
def emailsend(l_sender):
context = {
'news': 'We have good news!'
}
try:
send_html_email(l_sender, 'Get started with Aida', 'email.html', context, sender='wepredict@cathedral.ai')
print("Email send")
except Exception as e:
print(e)在email.html中,我插入了{{ context.news }},但没有附加任何内容。如何在mail.html中传递我的新闻val值?
提前感谢
发布于 2018-12-17 00:42:19
为什么是context.news?您必须使用{{ news }}。您调用的函数甚至看不到您的变量名为context。
https://stackoverflow.com/questions/53804271
复制相似问题