Skip to content

Commit

Permalink
Folder må eksistere for å rename
Browse files Browse the repository at this point in the history
  • Loading branch information
RettIProd committed Apr 15, 2024
1 parent f6028d4 commit c35c104
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions smtp-listeners/src/main/kotlin/no/nav/emottak/smtp/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.ktor.server.routing.Route
import io.ktor.server.routing.get
import jakarta.mail.Flags
import jakarta.mail.Folder
import jakarta.mail.Folder.HOLDS_MESSAGES
import jakarta.mail.internet.MimeMultipart
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -304,6 +305,7 @@ fun Folder.deleteAll() {
if (this is IMAPFolder) {
if (isOpen) close()
val deleteMeFolder = getFolder("DeleteMe")
if (!deleteMeFolder.exists()) create(HOLDS_MESSAGES)
this.renameTo(deleteMeFolder)
deleteMeFolder.delete(true)
log.info("${this.fullName} deleted.")
Expand Down

0 comments on commit c35c104

Please sign in to comment.