mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-07 05:15:43 +01:00
Refactoring
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user