mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
Fixed received from IP
This commit is contained in:
parent
5c47f41b36
commit
3a7f3bce01
1 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue