Align with smtp.mailfrom

pull/215/head
M66B 7 months ago
parent b82243eeb8
commit 4ffca45484

@ -64,7 +64,6 @@ import com.sun.mail.pop3.POP3Store;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@ -3507,7 +3506,7 @@ class Core {
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers)); message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
message.dkim = !signers.isEmpty(); message.dkim = !signers.isEmpty();
message.dmarc = Boolean.TRUE.equals(message.dmarc) || 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) if (message.size == null && message.total != null)
@ -4659,7 +4658,7 @@ class Core {
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers)); message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
message.dkim = !signers.isEmpty(); message.dkim = !signers.isEmpty();
message.dmarc = Boolean.TRUE.equals(message.dmarc) || 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 // Borrow reply name from sender name

@ -2610,12 +2610,14 @@ public class MessageHelper {
return null; 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<>(); List<Address> envelop = new ArrayList<>();
if (return_path != null) if (return_path != null)
envelop.addAll(Arrays.asList(return_path)); envelop.addAll(Arrays.asList(return_path));
if (from != null) if (from != null)
envelop.addAll(Arrays.asList(from)); envelop.addAll(Arrays.asList(from));
if (smtp_from != null)
envelop.addAll(Arrays.asList(smtp_from));
for (String signer : signers) { for (String signer : signers) {
for (Address a : envelop) { for (Address a : envelop) {
String domain = UriHelper.getEmailDomain(((InternetAddress) a).getAddress()); String domain = UriHelper.getEmailDomain(((InternetAddress) a).getAddress());

Loading…
Cancel
Save