diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java
index ea6b27865c..c7c606c632 100644
--- a/app/src/main/java/eu/faircode/email/EmailService.java
+++ b/app/src/main/java/eu/faircode/email/EmailService.java
@@ -73,6 +73,8 @@ import javax.mail.event.StoreListener;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
@@ -369,6 +371,15 @@ public class EmailService implements AutoCloseable {
} catch (MessagingException ex) {
if (port == 995 && !("pop3".equals(protocol) || "pop3s".equals(protocol)))
throw new MessagingException(context.getString(R.string.title_service_port), ex);
+ else if (ex.getMessage() != null &&
+ ex.getMessage().contains("Got bad greeting"))
+ throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
+ else if (ex.getCause() instanceof SSLException &&
+ ex.getCause().getMessage() != null &&
+ ex.getCause().getMessage().contains("Unable to parse TLS packet header"))
+ throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
+ else if (ex.getCause() instanceof SSLHandshakeException)
+ throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
else
throw ex;
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0a8a6d0601..0768d59920 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -643,6 +643,7 @@
Long press an identity to display options, like copy to create alias identities
This might be caused by the VPN that is being used
Please double check the port number
+ Please double check the protocol (SSL/TLS or STARTTLS)
Browse messages on the server
Mark messages read on expanding