1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-02 13:14:39 +00:00

Find server by NS records

This commit is contained in:
M66B 2022-10-12 11:59:50 +02:00
parent 84f416fc00
commit 86b343eca0

View file

@ -359,6 +359,18 @@ public class EmailProvider implements Parcelable {
return Arrays.asList(provider);
}
try {
DnsHelper.DnsRecord[] ns = DnsHelper.lookup(context, domain, "ns");
for (DnsHelper.DnsRecord record : ns)
for (EmailProvider provider : providers)
if (provider.mx != null)
for (String mx : provider.mx)
if (record.name.matches(mx))
return Arrays.asList(provider);
} catch (Throwable ex) {
Log.w(ex);
}
List<EmailProvider> candidates =
new ArrayList<>(_fromDomain(context, domain.toLowerCase(Locale.ROOT), email, discover));