password reset

9 views
Skip to first unread message

ExplaineR KhaN

unread,
Jun 1, 2019, 7:25:01 AM6/1/19
to Django users
​ i handle password reset
when i write this code can not me send email
def send_mail(to, template, context):
html_content = render_to_string(f'accounts/emails/{template}.html', context)
text_content = render_to_string(f'accounts/emails/{template}.txt', context)
msg = EmailMultiAlternatives(context['subject'], text_content, settings.EMAIL_HOST_USER, [to])
msg.attach_alternative(html_content, 'text/html')
msg.send()

when i write like this
send me email how to achieve dynamically
def send_mail(to, template, context):
html_content = render_to_string(f'accounts/emails/{template}.html', context)
text_content = render_to_string(f'accounts/emails/{template}.txt', context)
msg = EmailMultiAlternatives(context['subject'], text_content, settings.EMAIL_HOST_USER, ['inayatull...@gmail.com'])
msg.attach_alternative(html_content, 'text/html')
msg.send()
Reply all
Reply to author
Forward
0 new messages