diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 14d5c7b224..e1a704fe07 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -593,6 +593,9 @@ public class EmailService implements AutoCloseable { //System.setProperty("mail.socket.debug", Boolean.toString(debug)); isession.addProvider(new GmailSSLProvider()); + if (TextUtils.isEmpty(user)) + user = null; + if ("pop3".equals(protocol) || "pop3s".equals(protocol)) { iservice = isession.getStore(protocol); iservice.connect(address.getHostAddress(), port, user, null); diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index a4bbe118e8..2a27463968 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -649,7 +649,7 @@ public class FragmentAccount extends FragmentBase { throw new IllegalArgumentException(context.getString(R.string.title_no_host)); if (TextUtils.isEmpty(port)) port = (encryption == EmailService.ENCRYPTION_SSL ? "993" : "143"); - if (TextUtils.isEmpty(user)) + if (TextUtils.isEmpty(user) && !insecure) throw new IllegalArgumentException(context.getString(R.string.title_no_user)); if (TextUtils.isEmpty(password) && !insecure && certificate == null) throw new IllegalArgumentException(context.getString(R.string.title_no_password)); @@ -899,7 +899,7 @@ public class FragmentAccount extends FragmentBase { throw new IllegalArgumentException(context.getString(R.string.title_no_host)); if (TextUtils.isEmpty(port)) port = (encryption == EmailService.ENCRYPTION_SSL ? "993" : "143"); - if (TextUtils.isEmpty(user) && !should) + if (TextUtils.isEmpty(user) && !insecure && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_user)); if (synchronize && TextUtils.isEmpty(password) && !insecure && certificate == null && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_password)); diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 637603f719..e9e3880013 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -721,7 +721,7 @@ public class FragmentIdentity extends FragmentBase { port = "25"; else port = "465"; - if (TextUtils.isEmpty(user) && !should) + if (TextUtils.isEmpty(user) && !insecure && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_user)); if (synchronize && TextUtils.isEmpty(password) && !insecure && certificate == null && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_password)); diff --git a/app/src/main/java/eu/faircode/email/FragmentPop.java b/app/src/main/java/eu/faircode/email/FragmentPop.java index fd8b9e22aa..0e02f95b70 100644 --- a/app/src/main/java/eu/faircode/email/FragmentPop.java +++ b/app/src/main/java/eu/faircode/email/FragmentPop.java @@ -365,7 +365,7 @@ public class FragmentPop extends FragmentBase { throw new IllegalArgumentException(context.getString(R.string.title_no_host)); if (TextUtils.isEmpty(port)) port = (encryption == EmailService.ENCRYPTION_SSL ? "995" : "110"); - if (TextUtils.isEmpty(user) && !should) + if (TextUtils.isEmpty(user) && !insecure && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_user)); if (synchronize && TextUtils.isEmpty(password) && !insecure && !should) throw new IllegalArgumentException(context.getString(R.string.title_no_password));