Where can I look for logs that might help me find the cause of this? I have a Django app configured to deliver non-production environments email to a server running Mailcatcher. When I send text only email, it shows up in Mailcatcher, when I add the alternative HTML content, they do not.
I'm using EmailMultiAlternatives
and to test this I am commenting out my line with attach_alternative()
to send the text only, it is working fine. No errors from runserver, and email.send()
is returning 1.
Fails:
@staticmethod
def send_payment_confirmation(client, free_trial_days, recur_id):
context = {
'recur_id': recur_id,
'client': client,
'free_trial_days': free_trial_days
}
html_body = render_to_string('email/html/payment_confirmation.html', context)
text_body = render_to_string('email/text/payment_confirmation.txt', context)
email = EmailMultiAlternatives(subject=u"Thank You For Your Payment,{}".format(client.name),
body=text_body, to=[client.get_contact_email()], bcc=['support@example.com'])
email.attach_alternative(html_body, "text/html")
email.send()
Works:
@staticmethod
def send_payment_confirmation(client, free_trial_days, recur_id):
context = {
'recur_id': recur_id,
'client': client,
'free_trial_days': free_trial_days
}
html_body = render_to_string('email/html/payment_confirmation.html', context)
text_body = render_to_string('email/text/payment_confirmation.txt', context)
email = EmailMultiAlternatives(subject=u"Thank You For Your Payment,{}".format(client.name),
body=text_body, to=[client.get_contact_email()], bcc=['support@example.com'])
# email.attach_alternative(html_body, "text/html")
email.send()
Figured this out, it's a known bug with MailCatcher. Versions after 0.5.12
crash when they are sent utf8
html email. Current version is 0.6.4
- 2/4/16 (and still has the issue).
Downgrading to 0.5.12
resolves the problem.