Browse code

FEATWEBML-506 Fix: now accept 'Content-Type' header in mail_items/create API

Vincent Vignaud authored on 26/11/2019 13:35:27
Showing 2 changed files
... ...
@@ -173,7 +173,8 @@ public class EmlBuilder {
173 173
 			throws MimeException {
174 174
 		for (net.bluemind.backend.mail.api.MessageBody.Header h : headers) {
175 175
 			if (h.name.equals("Content-Type")) {
176
-				continue;
176
+				// remove previous one, only one "Content-Type" allowed
177
+				partHeader.removeFields(h.name);
177 178
 			}
178 179
 			if (h.values.size() == 1) {
179 180
 				ParsedField parsed = LenientFieldParser.parse(h.name + ": " + h.values.get(0));
... ...
@@ -74,7 +74,9 @@ export function saveDraft({ commit, state, getters }) {
74 74
             let structure;
75 75
             let textPart = {
76 76
                 mime: MimeType.TEXT_PLAIN,
77
-                address: addrParts[MimeType.TEXT_PLAIN]
77
+                address: addrParts[MimeType.TEXT_PLAIN],
78
+                headers: [{ name: "Content-Transfer-Encoding", values: ["QUOTED-PRINTABLE"] },
79
+                    { name: "Content-Type", values: [MimeType.TEXT_PLAIN + "; charset=utf-8"] }]
78 80
             };
79 81
 
80 82
             if (draft.type === "text") {
... ...
@@ -86,7 +88,9 @@ export function saveDraft({ commit, state, getters }) {
86 88
                         textPart,
87 89
                         {
88 90
                             mime: MimeType.TEXT_HTML,
89
-                            address: addrParts[MimeType.TEXT_HTML]
91
+                            address: addrParts[MimeType.TEXT_HTML],
92
+                            headers: [{ name: "Content-Transfer-Encoding", values: ["BASE64"] },
93
+                                { name: "Content-Type", values: [MimeType.TEXT_HTML + "; charset=utf-8"] }]
90 94
                         }
91 95
                     ]
92 96
                 };