From 060f5b027ba19377ad1a8a9c0fdb08d97ce02ced Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 29 Jul 2020 14:11:18 +0200 Subject: [PATCH] Check MX on send only if internet --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index b5c4ff9f3d..664c456c67 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -44,6 +44,7 @@ import android.graphics.drawable.GradientDrawable; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; +import android.net.NetworkInfo; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -4662,7 +4663,10 @@ public class FragmentCompose extends FragmentBase { if (addresses == null) return; - DnsHelper.checkMx(context, addresses); + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo ani = (cm == null ? null : cm.getActiveNetworkInfo()); + if (ani != null && ani.isConnected()) + DnsHelper.checkMx(context, addresses); } };