mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Use IP address for SMTP EHLO if hostname contains invalid characters, e.g. underscore.
Fixes issue 2143
This commit is contained in:
parent
7964c34dbd
commit
ba95150a31
@ -180,17 +180,19 @@ public class SmtpTransport extends Transport
|
||||
|
||||
InetAddress localAddress = mSocket.getLocalAddress();
|
||||
String localHost = localAddress.getHostName();
|
||||
String ipAddr = localAddress.getHostAddress();
|
||||
|
||||
if (localHost.equals(localAddress.getHostAddress()))
|
||||
if (localHost.equals(ipAddr) || localHost.contains("_"))
|
||||
{
|
||||
// We don't have a FQDN, so use IP address.
|
||||
// We don't have a FQDN or the hostname contains invalid
|
||||
// characters (see issue 2143), so use IP address.
|
||||
if (localAddress instanceof Inet6Address)
|
||||
{
|
||||
localHost = "[IPV6:" + localHost + "]";
|
||||
localHost = "[IPV6:" + ipAddr + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
localHost = "[" + localHost + "]";
|
||||
localHost = "[" + ipAddr + "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user