Find server by NS records

This commit is contained in:
M66B 2022-10-12 11:59:50 +02:00
parent 84f416fc00
commit 86b343eca0
1 changed files with 12 additions and 0 deletions

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));