mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Use a real hostname rather than localhost.localdomain.
Fixes Issue 45 Patch by cketti
This commit is contained in:
parent
a58095aae1
commit
74aac85048
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user