Search in sources :

Example 6 with BodyMailMessage

use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.

the class CorporateBilledCorporatePaidRouteStepReportServiceImpl method sendReportEmail.

@Override
public void sendReportEmail(String toAddress, String fromAddress) {
    BodyMailMessage message = new BodyMailMessage();
    message.setFromAddress(fromAddress);
    String subject = reportWriterService.getTitle();
    message.setSubject(subject);
    message.getToAddresses().add(toAddress);
    String body = concurBatchUtilityService.getFileContents(reportWriterService.getReportFile().getAbsolutePath());
    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 {
        emailService.sendMessage(message, htmlMessage);
    } catch (Exception e) {
        LOG.error("sendEmail, the email could not be sent", e);
    }
}
Also used : BodyMailMessage(org.kuali.kfs.sys.mail.BodyMailMessage) ValidationException(org.kuali.kfs.krad.exception.ValidationException)

Example 7 with BodyMailMessage

use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.

the class CreateAccountingDocumentReportServiceImpl method sendReportEmail.

@Override
public void sendReportEmail(String toAddress, String fromAddress) {
    BodyMailMessage message = new BodyMailMessage();
    message.setFromAddress(fromAddress);
    String subject = reportWriterService.getTitle();
    message.setSubject(subject);
    message.getToAddresses().add(toAddress);
    String body = concurBatchUtilityService.getFileContents(reportWriterService.getReportFile().getAbsolutePath());
    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 {
        emailService.sendMessage(message, htmlMessage);
    } catch (Exception e) {
        LOG.error("sendEmail, the email could not be sent", e);
    }
}
Also used : BodyMailMessage(org.kuali.kfs.sys.mail.BodyMailMessage)

Example 8 with BodyMailMessage

use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImpl method sendEmail.

private void sendEmail(FlatFileInformation fileInformation) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("sendEmail() starting");
    }
    BodyMailMessage message = new BodyMailMessage();
    String returnAddress = parameterService.getParameterValueAsString(LoadAchIncomeFileStep.class, CuFPParameterConstants.AchIncome.ACH_INCOME_SUMMARY_FROM_EMAIL_ADDRESS);
    if (StringUtils.isEmpty(returnAddress)) {
        returnAddress = emailService.getDefaultFromAddress();
    }
    message.setFromAddress(returnAddress);
    String subject = parameterService.getParameterValueAsString(LoadAchIncomeFileStep.class, CuFPParameterConstants.AchIncome.ACH_INCOME_SUMMARY_EMAIL_SUBJECT);
    message.setSubject(subject);
    List<String> toAddressList = new ArrayList<>(parameterService.getParameterValuesAsString(LoadAchIncomeFileStep.class, CuFPParameterConstants.AchIncome.ACH_INCOME_SUMMARY_TO_EMAIL_ADDRESSES));
    message.getToAddresses().addAll(toAddressList);
    String body = composeAchIncomeSummaryEmailBody(fileInformation);
    message.setMessage(body);
    emailService.sendMessage(message, false);
}
Also used : ArrayList(java.util.ArrayList) BodyMailMessage(org.kuali.kfs.sys.mail.BodyMailMessage) LoadAchIncomeFileStep(edu.cornell.kfs.fp.batch.LoadAchIncomeFileStep)

Example 9 with BodyMailMessage

use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.

the class ProcurementCardErrorEmailServiceImpl method sendErrorEmail.

public void sendErrorEmail(ArrayList<String> errorMessages) {
    BodyMailMessage message = new BodyMailMessage();
    message.setFromAddress(emailService.getDefaultFromAddress());
    message.setSubject(buildErrorEmailSubject());
    message.setToAddresses(getToAddresses());
    message.setMessage(generateBody(errorMessages));
    emailService.sendMessage(message, false);
}
Also used : BodyMailMessage(org.kuali.kfs.sys.mail.BodyMailMessage)

Example 10 with BodyMailMessage

use of org.kuali.kfs.sys.mail.BodyMailMessage in project cu-kfs by CU-CommunityApps.

the class CuPdpEmailServiceImpl method createAdviceMessageAndPopulateHeader.

/**
 * KFSPTS-1460: New method. created from code in sendAchAdviceEmail.
 * @return
 */
private BodyMailMessage createAdviceMessageAndPopulateHeader(PaymentGroup paymentGroup, CustomerProfile customer, String productionEnvironmentCode, String environmentCode) {
    LOG.debug("createAdviceMessageAndPopulateHeader() starting");
    BodyMailMessage message = new BodyMailMessage();
    String fromAddress = customer.getAdviceReturnEmailAddr();
    if ((fromAddress == null) || (fromAddress.isEmpty())) {
        // get the default from address
        fromAddress = parameterService.getParameterValueAsString(CUKFSParameterKeyConstants.KFS_PDP, CUKFSParameterKeyConstants.ALL_COMPONENTS, CUKFSParameterKeyConstants.PDP_CUSTOMER_MISSING_ADVICE_RETURN_EMAIL);
    }
    if (StringUtils.equals(productionEnvironmentCode, environmentCode)) {
        message.addToAddress(paymentGroup.getAdviceEmailAddress());
        message.addCcAddress(paymentGroup.getAdviceEmailAddress());
        message.addBccAddress(paymentGroup.getAdviceEmailAddress());
        message.setFromAddress(fromAddress);
        message.setSubject(customer.getAdviceSubjectLine());
    } else {
        message.addToAddress(emailService.getDefaultToAddress());
        message.addCcAddress(emailService.getDefaultToAddress());
        message.addBccAddress(emailService.getDefaultToAddress());
        message.setFromAddress(fromAddress);
        message.setSubject(environmentCode + ": " + customer.getAdviceSubjectLine() + ":" + paymentGroup.getAdviceEmailAddress());
    }
    LOG.debug("sending email to " + paymentGroup.getAdviceEmailAddress() + " for disb # " + paymentGroup.getDisbursementNbr());
    return message;
}
Also used : BodyMailMessage(org.kuali.kfs.sys.mail.BodyMailMessage)

Aggregations

BodyMailMessage (org.kuali.kfs.sys.mail.BodyMailMessage)14 ArrayList (java.util.ArrayList)3 LoadAchIncomeFileStep (edu.cornell.kfs.fp.batch.LoadAchIncomeFileStep)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 PaymentDetail (org.kuali.kfs.pdp.businessobject.PaymentDetail)1 EmailService (org.kuali.kfs.sys.service.EmailService)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1 CurrencyFormatter (org.kuali.rice.core.web.format.CurrencyFormatter)1 DateFormatter (org.kuali.rice.core.web.format.DateFormatter)1 Formatter (org.kuali.rice.core.web.format.Formatter)1 IntegerFormatter (org.kuali.rice.core.web.format.IntegerFormatter)1 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)1 Person (org.kuali.rice.kim.api.identity.Person)1