use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImpl method sendPayeeACHAccountAddOrUpdateEmail.
/**
* Sends an ACH Account add/update notification email to the given payee.
*
* @param achAccount The Payee ACH Account that was added or updated.
* @param payee The person affected by the change.
* @param emailSubject The email subject line.
* @param emailBody The email body; may contain "[propertyName]"-style placeholders to substitute in ACH Account values, as well as newlines.
*/
protected void sendPayeeACHAccountAddOrUpdateEmail(PayeeACHAccount achAccount, Person payee, String emailSubject, String emailBody) {
if (StringUtils.isBlank(payee.getEmailAddressUnmasked())) {
LOG.warn("Payee " + payee.getPrincipalName() + " has no email address defined in KFS. No notification emails will be sent for this user.");
return;
}
// Construct mail message, and replace property placeholders and literal "\n" strings in the email body accordingly.
BodyMailMessage message = new BodyMailMessage();
message.setFromAddress(parameterService.getParameterValueAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, KFSConstants.FROM_EMAIL_ADDRESS_PARM_NM));
message.setSubject(emailSubject);
message.setMessage(getResolvedEmailBody(achAccount, emailBody));
message.addToAddress(payee.getEmailAddressUnmasked());
// Send the message.
emailService.sendMessage(message, false);
}
use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.
the class CuPaymentFileServiceImpl method sendInactiveVendorsMessage.
/**
* Sends notification emails when a PDP XML file has one or more inactive vendors.
*
* @param customer The customer's profile.
* @param messageText The text to use as the body of the email message.
*/
private void sendInactiveVendorsMessage(CustomerProfile customer, String messageText) {
BodyMailMessage message = new BodyMailMessage();
message.setFromAddress(parameterService.getParameterValueAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, KFSConstants.FROM_EMAIL_ADDRESS_PARAM_NM));
message.setSubject("Inactive vendors detected in PDP feed for customer: " + customer.getCustomerDescription());
message.setMessage(messageText);
// Send to pre-determined recipient list, plus the customer's process email address.
message.setToAddresses(new HashSet<String>(parameterService.getParameterValuesAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, CUPdpParameterConstants.WARNING_INACTIVE_VENDOR_TO_EMAIL_ADDRESSES)));
message.addToAddress(customer.getProcessingEmailAddr());
emailService.sendMessage(message, false);
}
use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountDocumentServiceImpl method sendPayeeACHAccountAddOrUpdateEmail.
protected void sendPayeeACHAccountAddOrUpdateEmail(PayeeACHAccount achAccount, Person payee, String emailSubject, String emailBody) {
if (StringUtils.isBlank(payee.getEmailAddressUnmasked())) {
LOG.warn("Payee " + payee.getPrincipalName() + " has no email address defined in KFS. No notification emails will be sent for this user.");
return;
}
// Construct mail message, and replace property placeholders and literal "\n" strings in the email body accordingly.
BodyMailMessage message = new BodyMailMessage();
message.setFromAddress(parameterService.getParameterValueAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, KFSConstants.FROM_EMAIL_ADDRESS_PARAM_NM));
message.setSubject(emailSubject);
message.setMessage(getResolvedEmailBody(achAccount, emailBody));
message.addToAddress(payee.getEmailAddressUnmasked());
// Send the message.
emailService.sendMessage(message, false);
}
use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.
the class CuJobListener method notify.
protected void notify(JobExecutionContext jobExecutionContext, String jobStatus) {
try {
StringBuilder mailMessageSubject = new StringBuilder(jobExecutionContext.getJobDetail().getKey().getGroup()).append(": ").append(jobExecutionContext.getJobDetail().getKey().getName());
BodyMailMessage mailMessage = new BodyMailMessage();
mailMessage.setFromAddress(emailService.getDefaultFromAddress());
if (jobExecutionContext.getMergedJobDataMap().containsKey(REQUESTOR_EMAIL_ADDRESS_KEY) && !StringUtils.isBlank(jobExecutionContext.getMergedJobDataMap().getString(REQUESTOR_EMAIL_ADDRESS_KEY))) {
mailMessage.addToAddress(jobExecutionContext.getMergedJobDataMap().getString(REQUESTOR_EMAIL_ADDRESS_KEY));
}
if (SchedulerService.FAILED_JOB_STATUS_CODE.equals(jobStatus) || SchedulerService.CANCELLED_JOB_STATUS_CODE.equals(jobStatus)) {
mailMessage.addToAddress(emailService.getDefaultToAddress());
}
String url = SpringContext.getBean(ParameterService.class).getParameterValueAsString("KFS-SYS", "Batch", "BATCH_REPORTS_URL");
mailMessageSubject.append(": ").append(jobStatus);
String messageText = MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.MESSAGE_BATCH_FILE_LOG_EMAIL_BODY), url);
mailMessage.setMessage(messageText);
if (mailMessage.getToAddresses().size() > 0) {
mailMessage.setSubject(mailMessageSubject.toString());
emailService.sendMessage(mailMessage, false);
}
} catch (Exception iae) {
LOG.error("Caught exception while trying to send job completion notification e-mail for " + jobExecutionContext.getJobDetail().getKey().getName(), iae);
}
}
use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.
the class ConcurReportEmailServiceImpl method sendEmail.
@Override
public void sendEmail(String subject, String body) {
String toAddress = getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_REPORT_EMAIL_TO_ADDRESS);
String fromAddress = getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_REPORT_EMAIL_FROM_ADDRESS);
List<String> toAddressList = new ArrayList<>();
toAddressList.add(toAddress);
BodyMailMessage message = new BodyMailMessage();
message.setFromAddress(fromAddress);
message.setSubject(subject);
message.getToAddresses().addAll(toAddressList);
message.setMessage(body);
boolean htmlMessage = false;
if (LOG.isDebugEnabled()) {
LOG.debug("sendEmail, from address: " + fromAddress + " to address: " + toAddress);
LOG.debug("sendEmail, the email subject: " + subject);
LOG.debug("sendEmail, the email budy: " + body);
}
try {
getEmailService().sendMessage(message, htmlMessage);
} catch (Exception e) {
LOG.error("sendEmail, the email could not be sent", e);
}
}
Aggregations