|
|
@ -72,7 +72,6 @@ import javax.mail.Session;
|
|
|
|
import javax.mail.Store;
|
|
|
|
import javax.mail.Store;
|
|
|
|
import javax.mail.StoreClosedException;
|
|
|
|
import javax.mail.StoreClosedException;
|
|
|
|
import javax.mail.UIDFolder;
|
|
|
|
import javax.mail.UIDFolder;
|
|
|
|
import javax.mail.internet.AddressException;
|
|
|
|
|
|
|
|
import javax.mail.internet.InternetAddress;
|
|
|
|
import javax.mail.internet.InternetAddress;
|
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
|
import javax.mail.search.ComparisonTerm;
|
|
|
|
import javax.mail.search.ComparisonTerm;
|
|
|
@ -1096,23 +1095,22 @@ class Core {
|
|
|
|
Address[] froms = helper.getFrom();
|
|
|
|
Address[] froms = helper.getFrom();
|
|
|
|
Address[] tos = helper.getTo();
|
|
|
|
Address[] tos = helper.getTo();
|
|
|
|
Address[] ccs = helper.getCc();
|
|
|
|
Address[] ccs = helper.getCc();
|
|
|
|
String delivered = helper.getDeliveredTo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Build ordered list of addresses
|
|
|
|
// Build ordered list of addresses
|
|
|
|
List<Address> addresses = new ArrayList<>();
|
|
|
|
List<Address> addresses = new ArrayList<>();
|
|
|
|
if (delivered != null)
|
|
|
|
if (folder.isOutgoing()) {
|
|
|
|
try {
|
|
|
|
if (froms != null)
|
|
|
|
addresses.add(new InternetAddress(delivered));
|
|
|
|
addresses.addAll(Arrays.asList(froms));
|
|
|
|
} catch (AddressException ex) {
|
|
|
|
} else {
|
|
|
|
// Local address contains control or whitespace in string ``mailing list someone@example.org''
|
|
|
|
if (tos != null)
|
|
|
|
Log.w(ex);
|
|
|
|
addresses.addAll(Arrays.asList(tos));
|
|
|
|
|
|
|
|
if (ccs != null)
|
|
|
|
|
|
|
|
addresses.addAll(Arrays.asList(ccs));
|
|
|
|
|
|
|
|
if (EntityFolder.ARCHIVE.equals(folder.type)) {
|
|
|
|
|
|
|
|
if (froms != null)
|
|
|
|
|
|
|
|
addresses.addAll(Arrays.asList(froms));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tos != null)
|
|
|
|
}
|
|
|
|
addresses.addAll(Arrays.asList(tos));
|
|
|
|
|
|
|
|
if (ccs != null)
|
|
|
|
|
|
|
|
addresses.addAll(Arrays.asList(ccs));
|
|
|
|
|
|
|
|
if (froms != null)
|
|
|
|
|
|
|
|
addresses.addAll(Arrays.asList(froms));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Search for matching identity
|
|
|
|
// Search for matching identity
|
|
|
|
EntityIdentity identity = null;
|
|
|
|
EntityIdentity identity = null;
|
|
|
@ -1144,7 +1142,8 @@ class Core {
|
|
|
|
|
|
|
|
|
|
|
|
message.references = TextUtils.join(" ", helper.getReferences());
|
|
|
|
message.references = TextUtils.join(" ", helper.getReferences());
|
|
|
|
message.inreplyto = helper.getInReplyTo();
|
|
|
|
message.inreplyto = helper.getInReplyTo();
|
|
|
|
message.deliveredto = delivered;
|
|
|
|
// Local address contains control or whitespace in string ``mailing list someone@example.org''
|
|
|
|
|
|
|
|
message.deliveredto = helper.getDeliveredTo();
|
|
|
|
message.thread = helper.getThreadId(context, account.id, uid);
|
|
|
|
message.thread = helper.getThreadId(context, account.id, uid);
|
|
|
|
message.from = froms;
|
|
|
|
message.from = froms;
|
|
|
|
message.to = tos;
|
|
|
|
message.to = tos;
|
|
|
|