Fixed received from IP

This commit is contained in:
M66B 2020-02-10 10:45:28 +01:00
parent 5c47f41b36
commit 3a7f3bce01
1 changed files with 12 additions and 3 deletions

View File

@ -849,9 +849,18 @@ public class MessageHelper {
if (received == null || received.length == 0) if (received == null || received.length == 0)
return null; return null;
String[] h = MimeUtility.unfold(received[received.length - 1]).split("\\s+"); String origin = MimeUtility.unfold(received[received.length - 1]);
if (h.length > 1 && h[0].equalsIgnoreCase("from"))
return h[1]; String[] h = origin.split("\\s+");
if (h.length > 1 && h[0].equalsIgnoreCase("from")) {
String host = h[1];
if (host.startsWith("["))
host = host.substring(1);
if (host.endsWith("]"))
host = host.substring(0, host.length() - 1);
if (!TextUtils.isEmpty(host))
return host;
}
return null; return null;
} }