diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt index e983699..a6e3741 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/mail/MailReader.kt @@ -80,7 +80,7 @@ class MailReader( fun listAllMessagesWithEInvoice(account: MailAccount, downloadMessageBody: Boolean = false, emailFolderName: String = "INBOX"): List { try { - connect(account) { store -> + return connect(account) { store -> val inbox = store.getFolder(emailFolderName) inbox.open(Folder.READ_ONLY) @@ -243,7 +243,7 @@ class MailReader( date.toInstant() - private fun connect(account: MailAccount, connected: (Store) -> T?): T? { + private fun connect(account: MailAccount, connected: (Store) -> T): T { val properties = mapAccountToJavaMailProperties(account) val session = Session.getInstance(properties)