1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02: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:
cketti 2010-08-15 19:26:44 +00:00
parent 7964c34dbd
commit ba95150a31

View File

@ -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 + "]";
}
}