diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt index acdfe83..d1d0665 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt @@ -159,11 +159,15 @@ open class EmailsFetcher( val email = Email( status.folder.getUID(message), sender, message.subject ?: "", map(message.sentDate ?: message.receivedDate), + message.getRecipients(Message.RecipientType.TO).orEmpty().map { map(it) }, message.getRecipients(Message.RecipientType.CC).orEmpty().map { map(it) }, message.getRecipients(Message.RecipientType.BCC).orEmpty().map { map(it) }, (message.replyTo?.firstOrNull() as? InternetAddress)?.let { if (it.address != sender?.address) map(it) else null }, // only set replyTo if it differs from sender - parts.any { it.mediaType == "application/pgp-encrypted" }, - imapMessage?.contentLanguage?.firstOrNull(), + plainTextBody, getHtmlBody(messageBodyParts, status, plainTextBody), + + imapMessage?.contentLanguage?.firstOrNull(), + parts.any { it.mediaType == "application/pgp-encrypted" }, + attachments ) diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/model/Email.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/model/Email.kt index 3295134..9c12162 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/model/Email.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/model/Email.kt @@ -24,11 +24,12 @@ class Email( val bcc: List = emptyList(), val replayTo: EmailAddress? = null, - val isEncrypted: Boolean = false, - val contentLanguage: String? = null, val plainTextBody: String? = null, val htmlBody: String? = null, + val contentLanguage: String? = null, + val isEncrypted: Boolean = false, + val attachments: List = emptyList() ) { val plainTextOrHtmlBody: String? by lazy { plainTextBody ?: htmlBody }