mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 03:19:24 +01:00
Back to connecting to host name
This commit is contained in:
@@ -360,17 +360,13 @@ public class EmailService implements AutoCloseable {
|
||||
private void connect(
|
||||
String host, int port, String user, String password,
|
||||
SSLSocketFactoryService factory) throws MessagingException {
|
||||
InetAddress main = null;
|
||||
try {
|
||||
//if (BuildConfig.DEBUG)
|
||||
// throw new MailConnectException(
|
||||
// new SocketConnectException("Debug", new IOException("Test"), host, port, 0));
|
||||
|
||||
main = InetAddress.getByName(host);
|
||||
EntityLog.log(context, "Connecting to " + main);
|
||||
_connect(main.getHostAddress(), port, user, password, factory);
|
||||
} catch (UnknownHostException ex) {
|
||||
throw new MessagingException("Unknown host " + host, ex);
|
||||
EntityLog.log(context, "Connecting to " + host);
|
||||
_connect(host, port, user, password, factory);
|
||||
} catch (MessagingException ex) {
|
||||
boolean ioError = false;
|
||||
Throwable ce = ex;
|
||||
@@ -383,8 +379,10 @@ public class EmailService implements AutoCloseable {
|
||||
}
|
||||
|
||||
if (ioError) {
|
||||
EntityLog.log(context, "Connect ex=" + ex.getMessage());
|
||||
try {
|
||||
// Some devices resolve IPv6 addresses while not having IPv6 connectivity
|
||||
InetAddress main = InetAddress.getByName(host);
|
||||
InetAddress[] iaddrs = InetAddress.getAllByName(host);
|
||||
boolean ip4 = (main instanceof Inet4Address);
|
||||
boolean ip6 = (main instanceof Inet6Address);
|
||||
|
||||
Reference in New Issue
Block a user