@Override
    public void publish() {
        val mail = casProperties.getAuthn().getAdaptive().getRisk().getResponse().getMail();
        val principal = authentication.getPrincipal();
        mail.getAttributeName().forEach(attributeName -> {
            val resolvedAttribute = SpringExpressionLanguageValueResolver.getInstance().resolve(attributeName);
            if (principal.getAttributes().containsKey(resolvedAttribute)) {
                val verificationUrl = buildRiskVerificationUrl();
                val addresses = (List) principal.getAttributes().get(resolvedAttribute);
                val parameters = CollectionUtils.<String, Object>wrap("authentication", authentication,
                    "registeredService", registeredService,
                    "riskScore", authenticationRiskScore,
                    "verificationUrl", verificationUrl);
                val body = EmailMessageBodyBuilder.builder()
                    .properties(mail)
                    .parameters(parameters)
                    .build()
                    .get();
                val emailRequest = EmailMessageRequest.builder()
                    .emailProperties(mail)
                    .to(addresses)
                    .body(body)
                    .tenant(clientInfo.getTenant())
                    .build();
                addresses.forEach(address -> communicationsManager.email(emailRequest));
            } else {
                LOGGER.debug("Could not send email to [{}]. No email found for [{}] or email settings are not configured.",
                    principal.getId(), resolvedAttribute);
            }
        });

    }
This is {@link AuthenticationRiskEmailNotifier}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/notify/AuthenticationRiskEmailNotifier.java