successMessage = successMessage.concat(", Employee Email is not
found");
//get the sendTo value using approverPartyId
sendToApproved = EmailUtils.getEmailByParty(delegator, approverPartyId);
if (sendToApproved.trim().equals(""))
successMessage = successMessage.concat(", Approver Email is not
found");
//send email to human admin
Map<String, Object> emailCtx = FastMap.newInstance();
//set the body parameters
Map<String, Object> bodyParameters = FastMap.newInstance();
bodyParameters.put("title", toTitle);
bodyParameters.put("mailType", toMailType);
bodyParameters.put("mailDescription", toMailDescription);
bodyParameters.put("action", toAction);
bodyParameters.put("priority", "High");
bodyParameters.put("footerMsg", footer Message);
emailCtx.put("sendTo", sendToApproved);
emailCtx.put("sendFrom",sendFrom);
emailCtx.put("userLogin", userLogin);
emailCtx.put("bodyParameters", bodyParameters);
if (emailSendToApprover && !sendToApproved.equals("")){
try {
EmailUtils.sendProttayMail(ctx, emailCtx,bodyParameters);
} catch (Exception e) {
}
}
//send mail to requested person
bodyParameters.put("title", fromTitle);
bodyParameters.put("mailType", fromMailType);
bodyParameters.put("mailDescription", fromMailDescription);
bodyParameters.put("action", fromAction);
bodyParameters.put("priority", "High") ;
bodyParameters.put("footerMsg", footerMessage);
emailCtx.put("sendTo", sendFrom);
emailCtx.put("sendFrom",sendToApproved);
emailCtx.put("userLogin", userLogin);
emailCtx.put("bodyParameters", bodyParameters);
if (emailSendToEmployee && !sendFrom.equals("")){
try {
EmailUtils.sendProttayMail(ctx, emailCtx,bodyParameters);
} catch (Exception e) {
//return ServiceUtil.re turnError("send email failed");
successMessage = successMessage.concat(", Send Email failed");
}
}
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
result.put(ModelService.SUCCESS_MESSA GE, successMessage);
/*result.put(ModelService.ERROR_MESSAGE, "Leave will not proceed due to some
error.");*/
return result;
}
}