From fbfeb7ced6bef4df3d44ec9d45d5c55d90a73e1a Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 21 Nov 2024 21:50:59 +0100 Subject: [PATCH] Concatenating body parts --- .../src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt index 1136df6..d4012a9 100644 --- a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt +++ b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt @@ -213,9 +213,8 @@ class MailReader( } else if (partsForMediaTypeWithoutFilename.isEmpty()) { log.warn { "Multiple message parts with media type '$mediaType' found, but all have a filename" } null - } else { - log.warn { "Multiple message parts with media type '$mediaType' found, but more than one does not have a filename" } - partsForMediaTypeWithoutFilename.first().part.content as? String + } else { // if there are multiple parts without filename, then the second one is in most cases quoted previous message(s) + partsForMediaTypeWithoutFilename.mapNotNull { it.part.content as? String }.joinToString("\r\n") } } } catch (e: Throwable) {