In my project i have to send an email and pass a value into html code. I try this:
l_sender = []
l_sender.append('[email protected]')
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='[email protected]')
print("Email send")
except Exception as e:
print(e)
in email.html i insert {{ context.news }} but nothing appen. How can i pass my news val value in mail.html?
Thanks in advance
Why context.news? You must use {{ news }}
.
The function you called cannot even see that your variable was named context
.
Look at this examples: Creating email templates with Django