1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Use a real hostname rather than localhost.localdomain.

Fixes Issue 45

Patch by cketti
This commit is contained in:
Jesse Vincent 2010-02-02 02:06:35 +00:00
parent a58095aae1
commit 74aac85048

View File

@ -173,23 +173,13 @@ public class SmtpTransport extends Transport
// Eat the banner
executeSimpleCommand(null);
String localHost = "localhost.localdomain";
try
InetAddress localAddress = mSocket.getLocalAddress();
String localHost = localAddress.getHostName();
if (localHost.equals(localAddress.getHostAddress()))
{
InetAddress localAddress = InetAddress.getLocalHost();
if (! localAddress.isLoopbackAddress())
{
// The loopback address will resolve to 'localhost'
// some mail servers only accept qualified hostnames, so make sure
// never to override "localhost.localdomain" with "localhost"
// TODO - this is a hack. but a better hack than what was there before
localHost = localAddress.getHostName();
}
}
catch (Exception e)
{
if (K9.DEBUG)
Log.d(K9.LOG_TAG, "Unable to look up localhost");
// IP was returned
localHost = "[" + localHost + "]";
}
List<String> results = executeSimpleCommand("EHLO " + localHost);