From 6ffec50cd055dace8f726f1f768d530c6b392839 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 8 Apr 2020 17:57:02 +0200 Subject: [PATCH] Simplify retry sending after fatal errors --- app/src/main/java/eu/faircode/email/ServiceSend.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index a05cd41712..dee61dc8f5 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -352,6 +352,16 @@ public class ServiceSend extends ServiceBase { // Restore snooze timers for (EntityMessage message : db.message().getSnoozed(outbox.id)) EntityMessage.snooze(this, message.id, message.ui_snoozed); + + // Retry failed message + for (long id : db.message().getMessageByFolder(outbox.id)) { + int ops = db.operation().getOperationCount(outbox.id, id, EntityOperation.SEND); + if (ops == 0) { + EntityMessage message = db.message().getMessage(id); + if (message != null) + EntityOperation.queue(this, message, EntityOperation.SEND); + } + } } private void onSend(EntityMessage message) throws MessagingException, IOException {