Align with smtp.mailfrom

This commit is contained in:
M66B 2024-05-21 21:28:28 +02:00
parent b82243eeb8
commit 4ffca45484
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -2610,12 +2610,14 @@ public class MessageHelper {
return null;
}
boolean isAligned(Context context, List<String> signers, Address[] return_path, Address[] from) {
boolean isAligned(Context context, List<String> signers, Address[] return_path, Address[] smtp_from, Address[] from) {
List<Address> 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());