encode textual bodies as quoted printable by default

This commit is contained in:
Vincent Breitmoser 2016-08-08 15:13:40 +02:00
parent 08ef3d5ce5
commit 1c837930c8

View file

@ -26,11 +26,8 @@ public class MimeMessageHelper {
String mimeType = multipart.getMimeType(); String mimeType = multipart.getMimeType();
String contentType = String.format("%s; boundary=\"%s\"", mimeType, multipart.getBoundary()); String contentType = String.format("%s; boundary=\"%s\"", mimeType, multipart.getBoundary());
part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType); part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
if (MimeUtility.isSameMimeType(mimeType, "multipart/signed")) { // note: if this is ever changed to 8bit, multipart/signed parts must always be 7bit!
setEncoding(part, MimeUtil.ENC_7BIT); setEncoding(part, MimeUtil.ENC_7BIT);
} else {
setEncoding(part, MimeUtil.ENC_8BIT);
}
} else if (body instanceof TextBody) { } else if (body instanceof TextBody) {
String contentType; String contentType;
if (MimeUtility.mimeTypeMatches(part.getMimeType(), "text/*")) { if (MimeUtility.mimeTypeMatches(part.getMimeType(), "text/*")) {
@ -44,7 +41,7 @@ public class MimeMessageHelper {
} }
part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType); part.setHeader(MimeHeader.HEADER_CONTENT_TYPE, contentType);
setEncoding(part, MimeUtil.ENC_8BIT); setEncoding(part, MimeUtil.ENC_QUOTED_PRINTABLE);
} }
} }