From 1889a146060d468ec3692aa40c9b2247b69428b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Du=C5=A1ek?= Date: Fri, 2 Aug 2024 13:32:00 +0200 Subject: [PATCH] Update Mail.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow the content type to be extended with encoding. This is a must for non English characters like ěščřžýáíé to be properly rendered in the body as that requires the content type to be as "text/html; charset=utf-8" --- src/integration/mail/Mail.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/integration/mail/Mail.java b/src/integration/mail/Mail.java index 3acc365..e737d50 100644 --- a/src/integration/mail/Mail.java +++ b/src/integration/mail/Mail.java @@ -174,8 +174,8 @@ public static void sendMessage(String smtpHost, String to, String from, String r } mail.setSubject(subject); - if (!CONTENT_TYPE_PLAIN_TEXT.equals(contentType) && !CONTENT_TYPE_HTML.equals(contentType)) { - throw new MessagingException("The 'ContentType' field should be '" + CONTENT_TYPE_PLAIN_TEXT + "' or '" + if (!contentType.startsWith(CONTENT_TYPE_PLAIN_TEXT) && !contentType.startsWith(CONTENT_TYPE_HTML)) { + throw new MessagingException("The 'ContentType' field should start with '" + CONTENT_TYPE_PLAIN_TEXT + "' or '" + CONTENT_TYPE_HTML + "'."); } mail.setContentType(contentType);