mirror of https://github.com/M66B/FairEmail.git
Auto fix '501 Syntactically invalid HELO argument(s)'
This commit is contained in:
parent
15054c89e1
commit
ad07ae8032
|
@ -345,8 +345,9 @@ public class MailService implements AutoCloseable {
|
||||||
} else if ("smtp".equals(protocol) || "smtps".equals(protocol)) {
|
} else if ("smtp".equals(protocol) || "smtps".equals(protocol)) {
|
||||||
String[] c = BuildConfig.APPLICATION_ID.split("\\.");
|
String[] c = BuildConfig.APPLICATION_ID.split("\\.");
|
||||||
Collections.reverse(Arrays.asList(c));
|
Collections.reverse(Arrays.asList(c));
|
||||||
String haddr = TextUtils.join(".", c);
|
String domain = TextUtils.join(".", c);
|
||||||
|
|
||||||
|
String haddr = domain;
|
||||||
if (useip)
|
if (useip)
|
||||||
try {
|
try {
|
||||||
// This assumes getByName always returns the same address (type)
|
// This assumes getByName always returns the same address (type)
|
||||||
|
@ -363,7 +364,18 @@ public class MailService implements AutoCloseable {
|
||||||
properties.put("mail." + protocol + ".localhost", haddr);
|
properties.put("mail." + protocol + ".localhost", haddr);
|
||||||
|
|
||||||
iservice = isession.getTransport(protocol);
|
iservice = isession.getTransport(protocol);
|
||||||
|
try {
|
||||||
iservice.connect(host, port, user, password);
|
iservice.connect(host, port, user, password);
|
||||||
|
} catch (MessagingException ex) {
|
||||||
|
if (useip &&
|
||||||
|
ex.getMessage() != null &&
|
||||||
|
ex.getMessage().toLowerCase().contains("syntactically invalid")) {
|
||||||
|
Log.i("Using localhost=" + domain);
|
||||||
|
properties.put("mail." + protocol + ".localhost", domain);
|
||||||
|
iservice.connect(host, port, user, password);
|
||||||
|
} else
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
throw new NoSuchProviderException(protocol);
|
throw new NoSuchProviderException(protocol);
|
||||||
} catch (MessagingException ex) {
|
} catch (MessagingException ex) {
|
||||||
|
|
Loading…
Reference in New Issue