Django: Sending HTML Only Email

Prior to Django 1.7 (currently in dev), we don’t have any option to pass html version of an email to “send_mail()” from django.core.mail module. Even in the newer version, you can pass html template as an alternative but you have to pass a plain text version as well. What if you want to send html version, only? This is what I did –

Now you would pass html as the message parameter. I use django templates with “render_to_string()” function from django.template.loader module.

Do you know any other, perhaps smarter way to accomplish this? Please share in the comments! 🙂

5 Comments Django: Sending HTML Only Email

  1. Pingback: Creating a Responsive, HTML Email | Snakey Code

Leave a Reply

Your email address will not be published. Required fields are marked *