chibenwa commented on code in PR #2446: URL: https://github.com/apache/james-project/pull/2446#discussion_r1798877641
########## 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: ```suggestion LOGGER.info("Unable to parse the \"FROM\" header {}; ignoring.", message.getHeader("From")); ``` -- 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