Browse Source

Fixed JavaMail session

main
M66B 6 years ago
parent
commit
eea2c15587
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  2. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentIdentity.java
  3. +3
    -3
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -210,7 +210,7 @@ public class FragmentAccount extends Fragment {
// Check IMAP server // Check IMAP server
List<EntityFolder> folders = new ArrayList<>(); List<EntityFolder> folders = new ArrayList<>();
if (account.synchronize) { if (account.synchronize) {
Session isession = Session.getDefaultInstance(MessageHelper.getSessionProperties(), null);
Session isession = Session.getInstance(MessageHelper.getSessionProperties(), null);
IMAPStore istore = null; IMAPStore istore = null;
try { try {
istore = (IMAPStore) isession.getStore("imaps"); istore = (IMAPStore) isession.getStore("imaps");


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentIdentity.java View File

@ -244,7 +244,7 @@ public class FragmentIdentity extends Fragment {
// Check SMTP server // Check SMTP server
if (identity.synchronize) { if (identity.synchronize) {
Properties props = MessageHelper.getSessionProperties(); Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
Session isession = Session.getInstance(props, null);
Transport itransport = isession.getTransport(identity.starttls ? "smtp" : "smtps"); Transport itransport = isession.getTransport(identity.starttls ? "smtp" : "smtps");
try { try {
itransport.connect(identity.host, identity.port, identity.user, identity.password); itransport.connect(identity.host, identity.port, identity.user, identity.password);


+ 3
- 3
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -242,7 +242,7 @@ public class ServiceSynchronize extends LifecycleService {
Properties props = MessageHelper.getSessionProperties(); Properties props = MessageHelper.getSessionProperties();
props.put("mail.imaps.peek", "true"); props.put("mail.imaps.peek", "true");
//props.put("mail.imaps.minidletime", "5000"); //props.put("mail.imaps.minidletime", "5000");
Session isession = Session.getDefaultInstance(props, null);
Session isession = Session.getInstance(props, null);
// isession.setDebug(true); // isession.setDebug(true);
// adb -t 1 logcat | grep "eu.faircode.email\|System.out" // adb -t 1 logcat | grep "eu.faircode.email\|System.out"
@ -658,7 +658,7 @@ public class ServiceSynchronize extends LifecycleService {
return; return;
Properties props = MessageHelper.getSessionProperties(); Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
Session isession = Session.getInstance(props, null);
MimeMessage imessage = MessageHelper.from(msg, isession); MimeMessage imessage = MessageHelper.from(msg, isession);
ifolder.appendMessages(new Message[]{imessage}); ifolder.appendMessages(new Message[]{imessage});
@ -718,7 +718,7 @@ public class ServiceSynchronize extends LifecycleService {
// Create session // Create session
Properties props = MessageHelper.getSessionProperties(); Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getDefaultInstance(props, null);
Session isession = Session.getInstance(props, null);
// Create message // Create message
MimeMessage imessage; MimeMessage imessage;


Loading…
Cancel
Save