protected void sendEmail(final Principal principal, final String emailAttribute,
                             final String eventDetails, final ClientInfo clientInfo) {
        val mail = casProperties.getAuthn().getSurrogate().getMail();

        val resolvedAttribute = SpringExpressionLanguageValueResolver.getInstance().resolve(emailAttribute);
        val to = principal.getAttributes().get(resolvedAttribute);
        if (to != null) {
            CollectionUtils.firstElement(to).ifPresent(address -> {
                val body = EmailMessageBodyBuilder.builder()
                    .properties(mail)
                    .parameters(Map.of("event", eventDetails))
                    .build()
                    .get();

                val emailRequest = EmailMessageRequest.builder()
                    .emailProperties(mail)
                    .to(List.of(address.toString()))
                    .tenant(clientInfo.getTenant())
                    .body(body)
                    .build();
                communicationsManager.email(emailRequest);
            });
        } else {
            LOGGER.trace("The principal has no [{}] attribute, cannot send email notification", resolvedAttribute);
        }
    }
This is {@link DefaultSurrogateAuthenticationEventListener}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-surrogate-core/src/main/java/org/apereo/cas/authentication/event/DefaultSurrogateAuthenticationEventListener.java