diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 801f6b3746..32c06d006c 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -3696,7 +3696,7 @@ public class AdapterMessage extends RecyclerView.Adapter IDENTITY_ERROR_AFTER * 60 * 1000L) { + Log.i("Reporting send error after=" + delayed); + try { + NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + nm.notify("send:" + message.id, 1, + Core.getNotificationError(this, "warning", title, ex, pi).build()); + } catch (Throwable ex1) { + Log.w(ex1); + } + } + } + throw ex; + } } finally { Log.i(outbox.name + " end op=" + op.id + "/" + op.name); db.operation().setOperationState(op.id, null); @@ -570,7 +605,7 @@ public class ServiceSend extends ServiceBase { ServiceSynchronize.eval(ServiceSend.this, "sent"); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - nm.cancel("send:" + message.identity, 1); + nm.cancel("send:" + message.id, 1); } catch (MessagingException ex) { Log.e(ex); @@ -579,34 +614,6 @@ public class ServiceSend extends ServiceBase { db.identity().setIdentityError(ident.id, Log.formatThrowable(ex)); - if (ex instanceof AuthenticationFailedException || - ex instanceof SendFailedException) { - try { - NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - nm.notify("send:" + message.identity, 1, - Core.getNotificationError(this, "error", ident.name, ex) - .build()); - } catch (Throwable ex1) { - Log.w(ex1); - } - throw ex; - } - - EntityLog.log(this, ident.name + " last attempt: " + new Date(message.last_attempt)); - - long now = new Date().getTime(); - long delayed = now - message.last_attempt; - if (delayed > IDENTITY_ERROR_AFTER * 60 * 1000L) { - Log.i("Reporting send error after=" + delayed); - try { - NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - nm.notify("send:" + message.identity, 1, - Core.getNotificationError(this, "warning", ident.name, ex).build()); - } catch (Throwable ex1) { - Log.w(ex1); - } - } - throw ex; } finally { db.identity().setIdentityState(ident.id, null);