mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 13:47:05 +02:00
Check owner domain, not email server
This commit is contained in:
@@ -42,22 +42,23 @@ public class IPInfo {
|
||||
|
||||
private final static int FETCH_TIMEOUT = 15 * 1000; // milliseconds
|
||||
|
||||
static Pair<String, Organization> getOrganization(@NonNull Uri uri, Context context) throws IOException, ParseException {
|
||||
static Pair<InetAddress, Organization> getOrganization(@NonNull Uri uri, Context context) throws IOException, ParseException {
|
||||
if ("mailto".equalsIgnoreCase(uri.getScheme())) {
|
||||
MailTo email = MailTo.parse(uri.toString());
|
||||
String domain = UriHelper.getEmailDomain(email.getTo());
|
||||
if (domain == null)
|
||||
throw new UnknownHostException();
|
||||
InetAddress address = DnsHelper.lookupMx(context, domain);
|
||||
if (address == null)
|
||||
throw new UnknownHostException();
|
||||
return new Pair<>(domain, getOrganization(address, context));
|
||||
//InetAddress address = DnsHelper.lookupMx(context, domain);
|
||||
//if (address == null)
|
||||
// throw new UnknownHostException();
|
||||
InetAddress address = InetAddress.getByName(domain);
|
||||
return new Pair<>(address, getOrganization(address, context));
|
||||
} else {
|
||||
String host = uri.getHost();
|
||||
if (host == null)
|
||||
throw new UnknownHostException();
|
||||
InetAddress address = InetAddress.getByName(host);
|
||||
return new Pair<>(host, getOrganization(address, context));
|
||||
return new Pair<>(address, getOrganization(address, context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user