'Context has no dynamic value while sending email with send_mail() in django
I am trying to send mail with dynamic valued templates in django, But the parameter context sends nothing to the template
tasks.py
def send_verification_mail(username,mail):
msg_html = render_to_string('templates/email.html',
{'context':"value","context2":"value2"})
html=strip_tags(msg_html)
send_mail(
'From online store',
'Welcome '+username,
'[email protected]',
[mail],
html_message=html,
fail_silently=False,
)
email_template.html
<html>
<body>To verify click below<br>
<button> Verify your account</button>
{{context}} {{context2}}
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
