diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 2ebbc847f..8b96d2946 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -3045,6 +3045,15 @@ public class MessagingController implements Runnable { } } catch (Exception e) { + // 5.x.x errors from the SMTP server are "PERMFAIL" + // move the message over to drafts rather than leaving it in the outbox + // This is a complete hack, but is worlds better than the previous + // "don't even bother" functionality + if (getRootCauseMessage(e).startsWith("5")) { + localFolder.moveMessages(new Message[] { message }, (LocalFolder) localStore.getFolder(account.getDraftsFolderName())); + } else { + } + message.setFlag(Flag.X_SEND_FAILED, true); Log.e(K9.LOG_TAG, "Failed to send message", e); for (MessagingListener l : getListeners()) { @@ -3064,7 +3073,11 @@ public class MessagingController implements Runnable { l.sendPendingMessagesCompleted(account); } if (lastFailure != null) { - notifySendFailed(account, lastFailure); + if (getRootCauseMessage(lastFailure).startsWith("5")) { + notifySendPermFailed(account, lastFailure); + } else { + notifySendTempFailed(account, lastFailure); + } } } catch (UnavailableStorageException e) { Log.i(K9.LOG_TAG, "Failed to send pending messages because storage is not available - trying again later.");