﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37429	Cannot create multipart alternative mail with subparts	jddupas		"I want to create a mail with a plain/text alternative, and an html alternative containing images referenced by CID.
It used to be possible before Django 6, but the new API fails when trying to build such mail:


{{{
multipart/alternative
├── text/plain; charset=UTF-8
└── multipart/related; type=""text/html""
    ├── text/html; charset=UTF-8
    └── image/png
        Content-ID: <image001>
        Content-Disposition: inline
}}}


I tried to create the HTML + image part using a MIMEMultipart(""related""), but there is no way to attach it to the Django EmailMultiAlternatives.

The attach_alternative does not support taking a MimePart as content. It requires a content-type, and if this is text, in _add_bodies(), it calls add_alternative with a charset parameter, and fails as the charset argument is not supported by the content manager when inserting a MimePart.

When passing something else as content type, it convert the whole MimePart into base64 and insert it unstructured.
 
If I use the attach() method instead, the part is properly inserted, but the whole messages switch to mixed content-type, and not alternative content-type.


"	Bug	new	Core (Mail)	6.1	Normal		email		Unreviewed	0	0	0	0	0	0
