@Override
    public EmailCommunicationResult email(final EmailMessageRequest emailRequest) {
        val recipients = Objects.requireNonNull(emailRequest.getRecipients(), "Email recipients cannot be undefined");
        LOGGER.trace("Attempting to send email [{}] to [{}]", emailRequest.getBody(), recipients);
        return FunctionUtils.doIf(isMailSenderDefined() && emailRequest.getEmailProperties().isDefined() && !recipients.isEmpty(),
            Unchecked.supplier(() -> emailSender.send(emailRequest)),
            () -> EmailCommunicationResult.builder().success(false)
                .to(recipients).body(emailRequest.getBody()).build()).get();
    }
This is {@link DefaultCommunicationsManager}.

@author Misagh Moayyed
@since 5.1.0
core/cas-server-core-notifications-api/src/main/java/org/apereo/cas/notifications/DefaultCommunicationsManager.java