[Answer]-Partial and Broken Lines in Emails Sent by Django

1👍

However, in Django EmailMultiAlternatives documentation, there is
nothing about how to add headers like “format” or “Reply-To” in
EmailMultiAlternatives.

Actually, the documentation is very clear on this. If you look at the EmailMessage class documentation, it has the following:

headers: A dictionary of extra headers to put on the message. The keys are the header name, values are the header values. It’s up to the
caller to ensure header names and values are in the correct format for
an email message. The corresponding attribute is extra_headers.

Then further down on the same page it states:

Sending alternative content types

It can be useful to include multiple versions of the content in an
email; the classic example is to send both text and HTML versions of a
message. With Django’s email library, you can do this using the
EmailMultiAlternatives class. This subclass of EmailMessage has an
attach_alternative() method for including extra versions of the
message body in the email. All the other methods (including the class
initialization) are inherited directly from EmailMessage.

So, from here its clear that you can use headers in EmailMultiAlternatives, as its just a thin abstraction from the main EmailMessage class.

Leave a comment