diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 655dcbb34e..d902359f3f 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -1214,11 +1214,15 @@ public class MessageHelper { header = header.replaceAll("\\?=[\\r\\n\\t ]+=\\?", "\\?==\\?"); Address[] addresses = InternetAddress.parseHeader(header, false); + List
result = new ArrayList<>(); for (Address address : addresses) { InternetAddress iaddress = (InternetAddress) address; String email = iaddress.getAddress(); String personal = iaddress.getPersonal(); + if (TextUtils.isEmpty(email) && TextUtils.isEmpty(personal)) + continue; + email = decodeMime(email); if (!Helper.isSingleScript(email)) email = punyCode(email); @@ -1232,9 +1236,11 @@ public class MessageHelper { Log.w(ex); } } + + result.add(address); } - return addresses; + return (result.size() == 0 ? null : result.toArray(new Address[0])); } Address[] getReturnPath() throws MessagingException {