From 2c512579423b3b0f16e34b2667c1067bd8d8bacb Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 2 Dec 2019 13:27:52 +0100 Subject: [PATCH] Fixed plain text attachments --- .../java/eu/faircode/email/MessageHelper.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index d080056c88..3024c39f76 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -379,11 +379,6 @@ public class MessageHelper { BodyPart plainPart = new MimeBodyPart(); plainPart.setContent(plainContent, "text/plain; charset=" + Charset.defaultCharset().name()); - if (message.plain_only != null && message.plain_only) { - imessage.setContent(plainContent, plainPart.getContentType()); - return; - } - BodyPart htmlPart = new MimeBodyPart(); htmlPart.setContent(htmlContent, "text/html; charset=" + Charset.defaultCharset().name()); @@ -401,13 +396,21 @@ public class MessageHelper { } if (availableAttachments == 0) - imessage.setContent(altMultiPart); + if (message.plain_only != null && message.plain_only) + imessage.setContent(plainContent, plainPart.getContentType()); + else + imessage.setContent(altMultiPart); else { Multipart mixedMultiPart = new MimeMultipart("mixed"); Multipart relatedMultiPart = new MimeMultipart("related"); - BodyPart bodyPart = new MimeBodyPart(); - bodyPart.setContent(altMultiPart); + BodyPart bodyPart; + if (message.plain_only != null && message.plain_only) + bodyPart = plainPart; + else { + bodyPart = new MimeBodyPart(); + bodyPart.setContent(altMultiPart); + } if (hasInline) { relatedMultiPart.addBodyPart(bodyPart);