@Override
public ServiceResponse send(final String name, Map<String, String> params) {
FormEntity form = getDao().getFormDao().getByName(name);
if (form == null) {
return new ServiceResponse("error", Messages.get("form_not_found",
name));
}
String msgBody = createLetter(params);
String subject = form.getLetterSubject();
ConfigEntity config = getBusiness().getConfigBusiness().getConfig();
String fromAddress = config.getSiteEmail();
String fromText = config.getSiteDomain() + " admin";
String toAddress = form.getEmail();
String error = EmailUtil.sendEmail(msgBody, subject, fromAddress, fromText,
toAddress);
if (error == null) {
return new ServiceResponse("success", Messages.get(
"form.success_send", form.getEmail()));
}
else {
return new ServiceResponse("error", error);
}
}