diff --git a/FAQ.md b/FAQ.md index ed9606386f..34c18e55ca 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1078,7 +1078,7 @@ Note that this is independent of receiving messages. **(34) How are identities matched?** Identities are as expected matched by account. -For incoming messages the *to*, *cc*, *bcc* and *from* addresses will be checked +For incoming messages the *to*, *cc*, *bcc*, *from* and *(X-)delivered/envelope/original-to* addresses will be checked and for outgoing messages (drafts, outbox and sent) the *from* addresses will be checked. The matched address will be shown as *via* in the addresses section. diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index d1603713cb..3f9c9379c7 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -103,6 +103,7 @@ import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Store; import javax.mail.UIDFolder; +import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.search.ComparisonTerm; @@ -2434,6 +2435,12 @@ class Core { addresses.addAll(Arrays.asList(message.bcc)); if (message.from != null) addresses.addAll(Arrays.asList(message.from)); + if (message.deliveredto != null) + try { + addresses.add(new InternetAddress(message.deliveredto)); + } catch (AddressException ex) { + Log.w(ex); + } } // Search for matching identity