class AdminJsonService {

    @POST(path = "/backend/admin/send-test-email", permission = "admin:edit:smtp")
    String sendTestEmail(@BindRequest SmtpConfigDto configDto) throws IOException {
        // capturing newPlainPassword separately so that newPassword doesn't go through
        // encryption/decryption which has possibility of throwing
        // org.glowroot.common.repo.util.LazySecretKey.SymmetricEncryptionKeyMissingException
        SmtpConfigDto configDtoWithoutNewPassword;
        String passwordOverride;
        String newPassword = configDto.newPassword();
        if (newPassword.isEmpty()) {
            configDtoWithoutNewPassword = configDto;
            passwordOverride = null;
        } else {
            configDtoWithoutNewPassword = ImmutableSmtpConfigDto.builder()
                    .copyFrom(configDto)
                    .newPassword("")
                    .build();
            passwordOverride = newPassword;
        }
        String testEmailRecipient = configDtoWithoutNewPassword.testEmailRecipient();
        checkNotNull(testEmailRecipient);
        List<String> emailAddresses =
                Splitter.on(',').trimResults().splitToList(testEmailRecipient);
        try {
            String centralDisplay;
            String agentDisplay;
            if (central) {
                centralDisplay =
                        configRepository.getCentralAdminGeneralConfig().centralDisplayName();
                agentDisplay = "";
            } else {
                centralDisplay = "";
                agentDisplay = configRepository.getEmbeddedAdminGeneralConfig()
                        .agentDisplayNameOrDefault();
            }
            String subject = "Test email";
            AlertingService.sendEmail(centralDisplay, agentDisplay, subject, emailAddresses, "",
                    configDtoWithoutNewPassword.convert(configRepository), passwordOverride,
                    configRepository.getLazySecretKey(), mailService);
        } catch (Exception e) {
            logger.debug(e.getMessage(), e);
            return createErrorResponse(e);
        }
        return "{}";
    }

      AdminJsonService(boolean central, boolean offlineViewer, boolean webPortReadOnly,
            List<File> confDirs, ConfigRepository configRepository,
            RepoAdmin repoAdmin, LiveAggregateRepository liveAggregateRepository,
            MailService mailService, HttpClient httpClient);

}