mirror of https://github.com/M66B/FairEmail.git
Use delivered to header for identity matching
This commit is contained in:
parent
740c2b0318
commit
842cab974e
2
FAQ.md
2
FAQ.md
|
@ -704,7 +704,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* and *cc* address will be checked and for outgoing messages the *from* addresses will be checked.
|
||||
For incoming messages the (delivered) *to* and *cc* address will be checked and for outgoing messages the *from* addresses will be checked.
|
||||
Archived messages will be considered as incoming messages, but additionally the *from* address will be checked.
|
||||
|
||||
The matched address will be shown as *via* in the addresses section.
|
||||
|
|
|
@ -75,6 +75,7 @@ import javax.mail.Session;
|
|||
import javax.mail.Store;
|
||||
import javax.mail.StoreClosedException;
|
||||
import javax.mail.UIDFolder;
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.search.ComparisonTerm;
|
||||
|
@ -1143,6 +1144,7 @@ class Core {
|
|||
}
|
||||
|
||||
if (message == null) {
|
||||
String deliveredto = helper.getDeliveredTo();
|
||||
Address[] froms = helper.getFrom();
|
||||
Address[] tos = helper.getTo();
|
||||
Address[] ccs = helper.getCc();
|
||||
|
@ -1153,6 +1155,13 @@ class Core {
|
|||
if (froms != null)
|
||||
addresses.addAll(Arrays.asList(froms));
|
||||
} else {
|
||||
if (deliveredto != null)
|
||||
try {
|
||||
for (Address address : InternetAddress.parse(deliveredto))
|
||||
addresses.add(address);
|
||||
} catch (AddressException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
if (tos != null)
|
||||
addresses.addAll(Arrays.asList(tos));
|
||||
if (ccs != null)
|
||||
|
@ -1195,7 +1204,7 @@ class Core {
|
|||
message.references = TextUtils.join(" ", helper.getReferences());
|
||||
message.inreplyto = helper.getInReplyTo();
|
||||
// Local address contains control or whitespace in string ``mailing list someone@example.org''
|
||||
message.deliveredto = helper.getDeliveredTo();
|
||||
message.deliveredto = deliveredto;
|
||||
message.thread = helper.getThreadId(context, account.id, uid);
|
||||
message.receipt_request = helper.getReceiptRequested();
|
||||
message.receipt_to = helper.getReceiptTo();
|
||||
|
|
|
@ -449,7 +449,10 @@ public class MessageHelper {
|
|||
}
|
||||
|
||||
String getDeliveredTo() throws MessagingException {
|
||||
return imessage.getHeader("Delivered-To", imessage.getHeader("X-Delivered-To", null));
|
||||
String header = imessage.getHeader("Delivered-To", null);
|
||||
if (header == null)
|
||||
header = imessage.getHeader("X-Delivered-To", null);
|
||||
return header;
|
||||
}
|
||||
|
||||
String getInReplyTo() throws MessagingException {
|
||||
|
|
Loading…
Reference in New Issue