use of org.craftercms.profile.api.exceptions.I10nProfileException in project profile by craftercms.
the class VerificationServiceImpl method sendEmail.
@Override
@Async
public void sendEmail(VerificationToken token, Profile profile, String verificationBaseUrl, String from, String subject, String templateName) throws ProfileException {
String verificationUrl = createVerificationUrl(verificationBaseUrl, token.getId().toString());
Map<String, String> templateArgs = Collections.singletonMap(VERIFICATION_LINK_TEMPLATE_ARG, verificationUrl);
String[] to = new String[] { profile.getEmail() };
try {
emailFactory.getEmail(from, to, null, null, subject, templateName, templateArgs, true).send();
logger.debug(LOG_KEY_EMAIL_SENT, profile.getId(), profile.getEmail());
} catch (EmailException e) {
throw new I10nProfileException(ERROR_KEY_EMAIL_ERROR, e, profile.getEmail());
}
}
Aggregations