fixed email sending for html content type

This commit is contained in:
Sam
2021-03-12 13:45:36 +00:00
parent ffb39ba62f
commit 5da01b318e
4 changed files with 9 additions and 2 deletions

View File

@@ -65,11 +65,13 @@ class CompanyViewSet(viewsets.ModelViewSet):
# send email to company
subject = "Contacto de usuario"
email = EmailMessage(subject, company_message, to=[instance.creator.email])
email.content_subtype = "html"
email.send()
logging.info(f"Email sent to {instance.creator.email} as manager of {instance.name}")
# send confirmation email to user
subject = 'Confirmación de contacto'
email = EmailMessage(subject, message, to=[request.user.email])
email.content_subtype = "html"
email.send()
logging.info(f"Contact confirmation email sent to {request.user.email}")
stats_data = {
@@ -98,10 +100,12 @@ class CompanyViewSet(viewsets.ModelViewSet):
})
# send email to company
email = EmailMessage(subject, company_message, to=[instance.creator.email])
email.content_subtype = "html"
email.send()
logging.info(f"Email sent to {instance.creator.email} as manager of {instance.name}")
# send confirmation email to user
email = EmailMessage(subject, user_message, to=[data['email']])
email.content_subtype = "html"
email.send()
logging.info(f"Contact confirmation email sent to anonymous user {data['email']}")
# statslog data to register interaction