From 4ffca45484436a9f806ece19ee23acaebaa81075 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 21 May 2024 21:28:28 +0200 Subject: [PATCH] Align with smtp.mailfrom --- app/src/main/java/eu/faircode/email/Core.java | 5 ++--- app/src/main/java/eu/faircode/email/MessageHelper.java | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index ce8b1c8766..50fe03a0fe 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -64,7 +64,6 @@ import com.sun.mail.pop3.POP3Store; import org.json.JSONArray; import org.json.JSONException; -import org.json.JSONObject; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -3507,7 +3506,7 @@ class Core { message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers)); message.dkim = !signers.isEmpty(); message.dmarc = Boolean.TRUE.equals(message.dmarc) || - helper.isAligned(context, signers, message.return_path, message.from); + helper.isAligned(context, signers, message.return_path, message.smtp_from, message.from); } if (message.size == null && message.total != null) @@ -4659,7 +4658,7 @@ class Core { message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers)); message.dkim = !signers.isEmpty(); message.dmarc = Boolean.TRUE.equals(message.dmarc) || - helper.isAligned(context, signers, message.return_path, message.from); + helper.isAligned(context, signers, message.return_path, message.smtp_from, message.from); } // Borrow reply name from sender name diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 95b2c068b5..4387896564 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -2610,12 +2610,14 @@ public class MessageHelper { return null; } - boolean isAligned(Context context, List signers, Address[] return_path, Address[] from) { + boolean isAligned(Context context, List signers, Address[] return_path, Address[] smtp_from, Address[] from) { List
envelop = new ArrayList<>(); if (return_path != null) envelop.addAll(Arrays.asList(return_path)); if (from != null) envelop.addAll(Arrays.asList(from)); + if (smtp_from != null) + envelop.addAll(Arrays.asList(smtp_from)); for (String signer : signers) { for (Address a : envelop) { String domain = UriHelper.getEmailDomain(((InternetAddress) a).getAddress());