I need to generate a csv file based on the queryset result, attach the resulting file to an email as attachment and send. As you can see i need to iterate over the assigned_lead
Neither are working :(
Approach 1:
msg = EmailMultiAlternatives(subject, body, from_email, [to])
msg.attach_alternative(file_content, "text/html")
msg.content_subtype = 'html'
msg.send()
Approach 2:
# email = EmailMessage(
# 'Report Subject',
# "body",
# 'xx@yy.com',
# ['zz@uu.com'],
# connection=connection,
# )
# email.attach('Report.html', body, 'text/html')
# email.send()