Show send state/errors

This commit is contained in:
M66B
2018-08-15 11:26:59 +00:00
parent 92fc1349f0
commit ab485f8d43
10 changed files with 73 additions and 13 deletions

View File

@@ -978,7 +978,10 @@ public class ServiceSynchronize extends LifecycleService {
Transport itransport = isession.getTransport(ident.starttls ? "smtp" : "smtps");
try {
// Connect transport
db.identity().setIdentityState(ident.id, "connecting");
itransport.connect(ident.host, ident.port, ident.user, ident.password);
db.identity().setIdentityState(ident.id, "connected");
db.identity().setIdentityError(ident.id, null);
// Send message
Address[] to = imessage.getAllRecipients();
@@ -1013,8 +1016,15 @@ public class ServiceSynchronize extends LifecycleService {
} finally {
db.endTransaction();
}
} catch (MessagingException ex) {
db.identity().setIdentityError(ident.id, Helper.formatThrowable(ex));
throw ex;
} finally {
itransport.close();
try {
itransport.close();
} finally {
db.identity().setIdentityState(ident.id, null);
}
}
}