Fixed returning retrieved messages
This commit is contained in:
parent
e43a8a7239
commit
75450e77fb
|
@ -80,7 +80,7 @@ class MailReader(
|
||||||
|
|
||||||
fun listAllMessagesWithEInvoice(account: MailAccount, downloadMessageBody: Boolean = false, emailFolderName: String = "INBOX"): List<MailWithInvoice> {
|
fun listAllMessagesWithEInvoice(account: MailAccount, downloadMessageBody: Boolean = false, emailFolderName: String = "INBOX"): List<MailWithInvoice> {
|
||||||
try {
|
try {
|
||||||
connect(account) { store ->
|
return connect(account) { store ->
|
||||||
val inbox = store.getFolder(emailFolderName)
|
val inbox = store.getFolder(emailFolderName)
|
||||||
inbox.open(Folder.READ_ONLY)
|
inbox.open(Folder.READ_ONLY)
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class MailReader(
|
||||||
date.toInstant()
|
date.toInstant()
|
||||||
|
|
||||||
|
|
||||||
private fun <T> connect(account: MailAccount, connected: (Store) -> T?): T? {
|
private fun <T> connect(account: MailAccount, connected: (Store) -> T): T {
|
||||||
val properties = mapAccountToJavaMailProperties(account)
|
val properties = mapAccountToJavaMailProperties(account)
|
||||||
|
|
||||||
val session = Session.getInstance(properties)
|
val session = Session.getInstance(properties)
|
||||||
|
|
Loading…
Reference in New Issue