Refactoring

This commit is contained in:
M66B
2019-01-07 20:15:09 +00:00
parent 28bec6e592
commit a4bd27c3e8
3 changed files with 11 additions and 6 deletions

View File

@@ -559,10 +559,11 @@ public class FragmentIdentity extends FragmentEx {
// Check SMTP server
if (check) {
String transportType = (starttls ? "smtp" : "smtps");
Properties props = MessageHelper.getSessionProperties(auth_type, insecure);
Session isession = Session.getInstance(props, null);
isession.setDebug(true);
Transport itransport = isession.getTransport(starttls ? "smtp" : "smtps");
Transport itransport = isession.getTransport(transportType);
try {
try {
itransport.connect(host, Integer.parseInt(port), user, password);

View File

@@ -1742,9 +1742,13 @@ public class ServiceSynchronize extends LifecycleService {
db.message().setMessageLastAttempt(message.id, message.last_attempt);
}
// Create session
String transportType = (ident.starttls ? "smtp" : "smtps");
// Get properties
Properties props = MessageHelper.getSessionProperties(ident.auth_type, ident.insecure);
props.put("mail.smtp.localhost", ident.host);
// Create session
final Session isession = Session.getInstance(props, null);
// Create message
@@ -1774,7 +1778,7 @@ public class ServiceSynchronize extends LifecycleService {
// Create transport
// TODO: cache transport?
Transport itransport = isession.getTransport(ident.starttls ? "smtp" : "smtps");
Transport itransport = isession.getTransport(transportType);
try {
// Connect transport
db.identity().setIdentityState(ident.id, "connecting");