mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-25 15:11:52 -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
|
// Eat the banner
|
||||||
executeSimpleCommand(null);
|
executeSimpleCommand(null);
|
||||||
|
|
||||||
String localHost = "localhost.localdomain";
|
InetAddress localAddress = mSocket.getLocalAddress();
|
||||||
try
|
String localHost = localAddress.getHostName();
|
||||||
|
|
||||||
|
if (localHost.equals(localAddress.getHostAddress()))
|
||||||
{
|
{
|
||||||
InetAddress localAddress = InetAddress.getLocalHost();
|
// IP was returned
|
||||||
if (! localAddress.isLoopbackAddress())
|
localHost = "[" + localHost + "]";
|
||||||
{
|
|
||||||
// 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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> results = executeSimpleCommand("EHLO " + localHost);
|
List<String> results = executeSimpleCommand("EHLO " + localHost);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user