emailerConfiguration.setSsl(config.isSslEnabled());
emailerConfiguration.setTls(config.isTlsEnabled());
emailer.configure(emailerConfiguration);
MailRequest request = new MailRequest(NEXUS_MAIL_ID, DefaultMailType.DEFAULT_TYPE_ID);
request.setFrom(new Address(config.getSystemEmailAddress(), "Nexus Repository Manager"));
request.getToAddresses().add(new Address(email));
request.getBodyContext().put(DefaultMailType.SUBJECT_KEY, "Nexus: SMTP Configuration validation.");
StringBuilder body = new StringBuilder();
body.append("Your current SMTP configuration is valid!");
request.getBodyContext().put(DefaultMailType.BODY_KEY, body.toString());
MailRequestStatus status = emailer.sendSyncedMail(request);
if (status.getErrorCause() != null) {
log.error("Unable to send e-mail", status.getErrorCause());