From 8fe589ed45b03d6054b5524b8ddd6255ab16a610 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 5 Nov 2020 17:32:16 +0100 Subject: [PATCH] Create outbox if needed --- app/src/main/java/eu/faircode/email/EntityRule.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index b8c2b17b81..e8ee26f418 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -447,6 +447,12 @@ public class EntityRule { if (answer == null) throw new IllegalArgumentException("Rule answer not found name=" + name); + EntityFolder outbox = db.folder().getOutbox(); + if (outbox == null) { + outbox = EntityFolder.getOutbox(); + outbox.id = db.folder().insertFolder(outbox); + } + Address[] from = new InternetAddress[]{new InternetAddress(identity.email, identity.name, StandardCharsets.UTF_8.name())}; // Prevent loop @@ -463,7 +469,7 @@ public class EntityRule { EntityMessage reply = new EntityMessage(); reply.account = message.account; - reply.folder = db.folder().getOutbox().id; + reply.folder = outbox.id; reply.identity = identity.id; reply.msgid = EntityMessage.generateMessageId();