mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Added protocol hint
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user