Refactoring

pull/147/head
M66B 6 years ago
parent 28bec6e592
commit a4bd27c3e8

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

@ -172,12 +172,12 @@
<string name="title_account_notify">Separate notifications</string>
<string name="title_domain">Domain name</string>
<string name="title_autoconfig">Get settings</string>
<string name="title_imap">IMAP</string>
<string name="title_smtp">SMTP</string>
<string name="title_imap" translatable="false">IMAP</string>
<string name="title_smtp" translatable="false">SMTP</string>
<string name="title_provider">Provider</string>
<string name="title_custom">Custom</string>
<string name="title_host">Host name</string>
<string name="title_starttls">STARTTLS</string>
<string name="title_starttls" translatable="false">STARTTLS</string>
<string name="title_allow_insecure">Allow insecure connections</string>
<string name="title_port">Port number</string>
<string name="title_user">User name</string>

Loading…
Cancel
Save