@Override
    public EmailCommunicationResult send(final EmailMessageRequest emailRequest) {
        val emailProperties = emailRequest.getEmailProperties();
        val mailgun = casProperties.getEmailProvider().getMailgun();

        val messageBuilder = Message.builder()
            .from(emailProperties.getFrom())
            .to(emailRequest.getRecipients())
            .testMode(mailgun.isTestMode())
            .replyTo(emailProperties.getReplyTo())
            .tracking(true)
            .trackingOpens(true)
            .trackingClicks(YesNoHtml.YES)
            .subject(determineEmailSubject(emailRequest, messageSource));

        if (emailProperties.getCc() != null && !emailProperties.getCc().isEmpty()) {
            messageBuilder.cc(emailProperties.getCc());
        }
        if (emailProperties.getBcc() != null && !emailProperties.getBcc().isEmpty()) {
            messageBuilder.bcc(emailProperties.getBcc());
        }
        if (emailProperties.isHtml()) {
            messageBuilder.html(emailRequest.getBody());
        } else {
            messageBuilder.text(emailRequest.getBody());
        }

        var success = false;
        try {
            messagesApi.sendMessage(mailgun.getDomain(), messageBuilder.build());
            success = true;
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }
        return EmailCommunicationResult.builder()
            .success(success)
            .to(emailRequest.getRecipients())
            .body(emailRequest.getBody())
            .build();
    }
This is {@link MailgunEmailSender}.

@author Misagh Moayyed
@since 7.2.0
support/cas-server-support-mailgun/src/main/java/org/apereo/cas/mail/MailgunEmailSender.java