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


##########
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:
   Hmm that would require to do again a mail.getMessage().getHeader("From") 
which could... raise an other MessagingException, not sure we want a try catch 
in a try catch for the same exception?



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