1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Permanent failures when trying to deliver a message move it back to

drafts.

Opening a "permfail" message takes you to the drafts folder
This commit is contained in:
Jesse Vincent 2011-03-09 22:41:44 -05:00
parent d80a941dba
commit 2affa9d52b

View File

@ -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.");