Match MX record with IMAP host name

pull/203/head
M66B 3 years ago
parent bc5f4d1701
commit b1a0ae247a

@ -290,14 +290,23 @@ public class EmailProvider implements Parcelable {
for (DnsHelper.DnsRecord record : records)
if (!TextUtils.isEmpty(record.name))
for (EmailProvider provider : providers)
for (EmailProvider provider : providers) {
if (provider.mx != null)
for (String mx : provider.mx)
if (record.name.toLowerCase(Locale.ROOT).matches(mx)) {
EntityLog.log(context, "Provider from mx=" + mx + " domain=" + domain);
EntityLog.log(context, "Provider from mx=" + record.name + " domain=" + domain);
provider.log(context);
return provider;
}
String mxparent = UriHelper.getParentDomain(context, record.name);
String pdomain = UriHelper.getParentDomain(context, provider.imap.host);
if (mxparent.equalsIgnoreCase(pdomain)) {
EntityLog.log(context, "Provider from mx=" + record.name + " host=" + provider.imap.host);
provider.log(context);
return provider;
}
}
for (DnsHelper.DnsRecord record : records) {
String target = record.name;

@ -55,7 +55,7 @@ public class UriHelper {
if ((suffixList.contains(h) || suffixList.contains(w)) &&
!suffixList.contains('!' + h)) {
String parent = prefix + "." + h;
Log.i("Host=" + host + " parent=" + parent);
Log.d("Host=" + host + " parent=" + parent);
return parent;
}
}

@ -1147,8 +1147,7 @@
</provider>
<provider
name="GoDaddy Workspace"
link="https://www.godaddy.com/help/server-and-port-settings-for-workspace-email-6949"
mx=".*\\.secureserver\\.net">
link="https://www.godaddy.com/help/server-and-port-settings-for-workspace-email-6949">
<imap
host="imap.secureserver.net"
port="993"
@ -1224,8 +1223,7 @@
</provider>
<provider
name="Mail.com"
link="https://support.mail.com/premium/imap/server.html#indexlink_help_premium_imap"
mx=".*\\.mail\\.com">
link="https://support.mail.com/premium/imap/server.html#indexlink_help_premium_imap">
<imap
host="imap.mail.com"
port="993"
@ -1237,8 +1235,7 @@
</provider>
<provider
name="Namecheap"
link="https://www.namecheap.com/support/knowledgebase/article.aspx/1179/2175/general-private-email-configuration-for-mail-clients-and-mobile-devices/"
mx=".*\\.privateemail\\.com">
link="https://www.namecheap.com/support/knowledgebase/article.aspx/1179/2175/general-private-email-configuration-for-mail-clients-and-mobile-devices/">
<imap
host="mail.privateemail.com"
port="993"

Loading…
Cancel
Save