Fixed IPv6 SMTP EHLO

pull/150/head
M66B 6 years ago
parent 3fc0b6cb27
commit 35159f9865

@ -52,6 +52,7 @@ import com.android.colorpicker.ColorPickerSwatch;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
@ -603,11 +604,12 @@ public class FragmentIdentity extends FragmentBase {
else
props.put("mail.smtps.localhost", host);
} else {
Log.i("Check local address=" + ip.getHostAddress());
String haddr = (ip instanceof Inet6Address ? "IPv6:" : "") + ip.getHostAddress();
Log.i("Check local address=" + haddr);
if (starttls)
props.put("mail.smtp.localaddress", ip.getHostAddress());
props.put("mail.smtp.localaddress", haddr);
else
props.put("mail.smtps.localaddress", ip.getHostAddress());
props.put("mail.smtps.localaddress", haddr);
}
// Create session

@ -76,6 +76,7 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
@ -735,11 +736,11 @@ public class Helper {
return filename.substring(index + 1);
}
static InetAddress getLocalIp(Context context) {
static InetAddress getLocalIp(Context context) throws UnknownHostException {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M)
return null;
return InetAddress.getLocalHost();
Network active = cm.getActiveNetwork();
if (active == null)

@ -73,6 +73,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.SocketTimeoutException;
@ -1947,11 +1948,12 @@ public class ServiceSynchronize extends LifecycleService {
else
props.put("mail.smtps.localhost", ident.host);
} else {
EntityLog.log(ServiceSynchronize.this, "Send local address=" + ip.getHostAddress());
String haddr = (ip instanceof Inet6Address ? "IPv6:" : "") + ip.getHostAddress();
EntityLog.log(ServiceSynchronize.this, "Send local address=" + haddr);
if (ident.starttls)
props.put("mail.smtp.localaddress", ip.getHostAddress());
props.put("mail.smtp.localaddress", haddr);
else
props.put("mail.smtps.localaddress", ip.getHostAddress());
props.put("mail.smtps.localaddress", haddr);
}
// Create session

Loading…
Cancel
Save