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()