use of com.synopsys.integration.alert.service.email.EmailTarget in project hub-alert by blackducksoftware.
the class UpdateEmailService method handleSend.
private void handleSend(Properties javamailProperties, String smtpFrom, String smtpHost, int smtpPort, boolean smtpAuth, String smtpUsername, String smtpPassword, Map<String, Object> templateFields, String emailAddress) throws AlertException {
try {
String alertLogo = alertProperties.createSynopsysLogoPath();
Map<String, String> contentIdsToFilePaths = new HashMap<>();
emailMessagingService.addTemplateImage(templateFields, contentIdsToFilePaths, EmailPropertyKeys.EMAIL_LOGO_IMAGE.getPropertyKey(), alertLogo);
EmailTarget passwordResetEmail = new EmailTarget(emailAddress, TEMPLATE_NAME, templateFields, contentIdsToFilePaths);
emailMessagingService.sendEmailMessage(javamailProperties, smtpFrom, smtpHost, smtpPort, smtpAuth, smtpUsername, smtpPassword, passwordResetEmail);
} catch (Exception genericException) {
throw new AlertException("Problem sending version update email. " + StringUtils.defaultIfBlank(genericException.getMessage(), StringUtils.EMPTY), genericException);
}
}
Aggregations