1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Fixed received from IP

This commit is contained in:
M66B 2020-02-10 10:45:28 +01:00
parent 5c47f41b36
commit 3a7f3bce01

View file

@ -849,9 +849,18 @@ public class MessageHelper {
if (received == null || received.length == 0)
return null;
String[] h = MimeUtility.unfold(received[received.length - 1]).split("\\s+");
if (h.length > 1 && h[0].equalsIgnoreCase("from"))
return h[1];
String origin = MimeUtility.unfold(received[received.length - 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;
}