mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 03:15:39 +01:00
Ignore unrecoverable DNS errors
This commit is contained in:
@@ -501,6 +501,8 @@ public class EmailProvider {
|
||||
try {
|
||||
// Identifies an IMAP server where TLS is initiated directly upon connection to the IMAP server.
|
||||
DnsHelper.DnsRecord[] records = DnsHelper.lookup(context, "_imaps._tcp." + domain, "srv");
|
||||
if (records.length == 0)
|
||||
throw new UnknownHostException(domain);
|
||||
// ... service is not supported at all at a particular domain by setting the target of an SRV RR to "."
|
||||
provider.imap.host = records[0].name;
|
||||
provider.imap.port = records[0].port;
|
||||
@@ -508,6 +510,8 @@ public class EmailProvider {
|
||||
} catch (UnknownHostException ex) {
|
||||
// Identifies an IMAP server that MAY ... require the MUA to use the "STARTTLS" command
|
||||
DnsHelper.DnsRecord[] records = DnsHelper.lookup(context, "_imap._tcp." + domain, "srv");
|
||||
if (records.length == 0)
|
||||
throw new UnknownHostException(domain);
|
||||
provider.imap.host = records[0].name;
|
||||
provider.imap.port = records[0].port;
|
||||
provider.imap.starttls = (provider.imap.port == 143);
|
||||
@@ -517,6 +521,8 @@ public class EmailProvider {
|
||||
if (discover == Discover.ALL || discover == Discover.SMTP) {
|
||||
// Note that this covers connections both with and without Transport Layer Security (TLS)
|
||||
DnsHelper.DnsRecord[] records = DnsHelper.lookup(context, "_submission._tcp." + domain, "srv");
|
||||
if (records.length == 0)
|
||||
throw new UnknownHostException(domain);
|
||||
provider.smtp.host = records[0].name;
|
||||
provider.smtp.port = records[0].port;
|
||||
provider.smtp.starttls = (provider.smtp.port == 587);
|
||||
|
||||
Reference in New Issue
Block a user