Check for duplicate Return-Path headers

This commit is contained in:
M66B 2021-03-06 15:39:55 +01:00
parent 00edea51f2
commit 1c29bed5d4
1 changed files with 17 additions and 1 deletions

View File

@ -1257,7 +1257,23 @@ public class MessageHelper {
} }
Address[] getReturnPath() throws MessagingException { Address[] getReturnPath() throws MessagingException {
return getAddressHeader("Return-Path"); Address[] addresses = getAddressHeader("Return-Path");
if (addresses == null)
return null;
List<Address> result = new ArrayList<>();
for (int i = 0; i < addresses.length; i++) {
boolean duplicate = false;
for (int j = 0; j < i; j++)
if (addresses[i].equals(addresses[j])) {
duplicate = true;
break;
}
if (!duplicate)
result.add(addresses[i]);
}
return result.toArray(new Address[0]);
} }
Address[] getSender() throws MessagingException { Address[] getSender() throws MessagingException {