From c84c517f626222f8abd20934d392ab11c9d0c914 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 12 May 2019 21:37:26 +0200 Subject: [PATCH] Pass extra parameter to children of multipart/alternative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A structure like this is quite common: ─> [multipa/related, 7bit, 12K] ├─> [multipa/alternativ, 7bit, 9.0K] │ ├─> [text/plain, quoted, iso-8859-1, 3.7K] │ └─> [text/html, quoted, iso-8859-1, 4.9K] └─>2b0063.jpg [image/jpeg, base64, 3.3K] Here the main content of multipart/related isn't the html part, but a multipart/alternative containing the html part and a text part. The html part still needs access to the onther content of the multipart/related part, so we need to pass this through. --- mbox2web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbox2web b/mbox2web index c100bed..e95fabf 100755 --- a/mbox2web +++ b/mbox2web @@ -254,7 +254,7 @@ def render_body(msg, extra=None): partstypes = [] for part in msg.get_payload(): partstypes.append(part.get_content_type()) - partshtml.append(render_body(part)) + partshtml.append(render_body(part, extra)) bodytmpl = jenv.get_template("body_multipart_alternative.html") context = { "types": partstypes,