diff --git a/mbox2web b/mbox2web index 6201441..fa5c10c 100755 --- a/mbox2web +++ b/mbox2web @@ -211,6 +211,26 @@ def render_body(msg): } bodyhtml = bodytmpl.render(context) + elif content_type == "multipart/alternative": + partshtml = [] + partstypes = [] + for part in msg.get_payload(): + partstypes.append(part.get_content_type()) + partshtml.append(render_body(part)) + bodytmpl = jenv.get_template("body_multipart_alternative.html") + context = { + "types": partstypes, + "parts": partshtml, + } + bodyhtml = bodytmpl.render(context) + + elif content_type == "application/x-unknown-content-type-scpfile": + bodytmpl = jenv.get_template("body_application_x-unknown-content-type-scpfile.html") + context = { + "body": msg.get_payload(decode=True).decode(msg.get_charset() or "iso-8859-1") + } + bodyhtml = bodytmpl.render(context) + else: raise RuntimeError("Content-type " + content_type + " not implemented yet") diff --git a/templates/body_application_x-unknown-content-type-scpfile.html b/templates/body_application_x-unknown-content-type-scpfile.html new file mode 100644 index 0000000..50e5824 --- /dev/null +++ b/templates/body_application_x-unknown-content-type-scpfile.html @@ -0,0 +1,10 @@ +
+
+ application/x-unknown-content-type-scpfile +
+
+
+{{body}}
+
+
+
diff --git a/templates/body_multipart_alternative.html b/templates/body_multipart_alternative.html new file mode 100644 index 0000000..5204d46 --- /dev/null +++ b/templates/body_multipart_alternative.html @@ -0,0 +1,24 @@ +
+
+ multipart/alternative +
+
+ {% for type in types %} + + + + {% endfor %} + {% for part in parts %} +
+ {{part}} +
+ {% endfor %} +
+