chibenwa commented on code in PR #2446:
URL: https://github.com/apache/james-project/pull/2446#discussion_r1798968838


##########
server/protocols/protocols-smtp-dkim/src/main/java/org/apache/james/smtpserver/DKIMHook.java:
##########
@@ -92,6 +104,35 @@ static DKIMCheckNeeded onlyForSenderDomain(Domain domain) {
                 .orElse(false);
         }
 
+        static DKIMCheckNeeded onlyForHeaderFromDomain(Domain domain) {
+            return mail -> {
+                try {
+                    return StreamUtils.ofNullable(mail.getMessage().getFrom())
+                        .distinct()
+                        .flatMap(DKIMCheckNeeded::parseMailAddress)
+                        .findFirst()
+                        .map(MailAddress::getDomain)
+                        .map(domain::equals)
+                        .orElse(false);
+                } catch (MessagingException me) {
+                    LOGGER.info("Unable to parse the \"FROM\" header; 
ignoring.");

Review Comment:
   Yep but getting the actual failing value is worthwhile: being the one 
reading prod logs I can tell you I want this. Note also I am not asking for 
parsed form but row form which is unlikely to fail...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to