From 3da97806218994554b78d048f256c3ad6a32cfef Mon Sep 17 00:00:00 2001 From: edwardcwang Date: Thu, 17 Feb 2022 01:59:38 -0500 Subject: [PATCH] Respect custom Message-IDs in JavaMail backend Currently the JavaMail backend is hardcoded to ignore a custom MessageId such as the one below: ```scala MailBuilder.build( From("hello@example.com"), To("goodbye@example.com"), MessageID(s""), Subject("Hello!"), TextBody("Hello!"), ) ``` --- .../src/main/scala/emil/javamail/internal/ops/SendMail.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/javamail/src/main/scala/emil/javamail/internal/ops/SendMail.scala b/modules/javamail/src/main/scala/emil/javamail/internal/ops/SendMail.scala index 3b343c83..c1c3b3b8 100644 --- a/modules/javamail/src/main/scala/emil/javamail/internal/ops/SendMail.scala +++ b/modules/javamail/src/main/scala/emil/javamail/internal/ops/SendMail.scala @@ -20,7 +20,7 @@ object SendMail { logger.debugF(s"Sending ${mails.size} mail(s) using ${conn.config}") *> mails.traverse { mail => ThreadClassLoader { - cm.convert(conn.session, MessageIdEncode.Random, mail).flatMap { msg => + cm.convert(conn.session, MessageIdEncode.GivenOrRandom, mail).flatMap { msg => val msgId = checkMessageID(msg) Sync[F].blocking { logger.debug(s"Sending message: ${infoLine(mail.header)}, $msgId")