Skip to content

Commit

Permalink
Issue #3015 cherry-pick
Browse files Browse the repository at this point in the history
  • Loading branch information
mzueva committed Mar 14, 2023
1 parent 8e4043a commit aee4fe0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ private Optional<Email> buildEmail(NotificationMessage message) throws EmailExce
}

String userEmail = getTargetUserEmail(message);
if (userEmail != null) {
if (isValidEmail(userEmail)) {
email.addTo(userEmail);
}

List<PipelineUser> keepInformedUsers = userRepository.findByIdIn(message.getCopyUserIds());

for (PipelineUser user : keepInformedUsers) {
String address = user.getEmail();
if (address != null) {
if (isValidEmail(address)) {
email.addBcc(address);
}
}
Expand Down Expand Up @@ -197,4 +197,8 @@ private void sleepIfRequired(final long delay) {
}
}

private boolean isValidEmail(final String email) {
return EmailValidator.getInstance().isValid(email);
}

}

0 comments on commit aee4fe0

Please sign in to comment.