sklarsa / django-sendgrid-v5

An implementation of Django's EmailBackend compatible with sendgrid-python v5+
MIT License
323 stars 54 forks source link

Does not include both text/plain and text/html versions. #2

Closed jgerigmeyer closed 7 years ago

jgerigmeyer commented 7 years ago

After upgrading from sendgrid-django, our emails used to be multipart/alternative with both text/plain and text/html content included, but are now simply text/html -- the plain text version is no longer included.

In sendgrid-django, an email that inherited from EmailMultiAlternatives would trigger both mail.add_content(Content("text/plain", email.body)) and mail.add_content(Content(alt[1], alt[0])). It appears that in django-sendgrid-v5, the same email only triggers mail.add_content(Content(alt[1], alt[0])) without adding the text/plain content.

The relevant diff seems to be https://github.com/elbuo8/sendgrid-django/blob/master/sgbackend/mail.py#L87-L91 vs https://github.com/sklarsa/django-sendgrid-v5/blob/master/sendgrid_backend/mail.py#L136-L144.

Is this an intentional change? My understanding of Django mail implies that a message with both message and html_message args should include both content types.

sklarsa commented 7 years ago

Looks like that was an oversight on my part. I made the relevant fix, incremented the version to 0.6.7, and just published the package to PyPi. Thanks for pointing this out! Let me know if you have any additional problems related to this change.