}
@Override
public String sendEmail(FormDataEntity formData) {
FormEntity form = getFormDao().getById(formData.getFormId());
ConfigEntity config = VosaoContext.getInstance().getConfig();
FormConfigEntity formConfig = getDao().getFormConfigDao().getConfig();
VelocityContext context = new VelocityContext();
List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
context.put("form", form);
context.put("fields", fields);
context.put("values", formData.getValues());
context.put("config", config);
String letter = getSystemService().render(
formConfig.getLetterTemplate(), context);
List<String> emails = StrUtil.fromCSV(form.getEmail());
for (String email : emails) {
String error = EmailUtil.sendEmail(
letter,
form.getLetterSubject(),
config.getSiteEmail(),
"Site admin",
StringUtils.strip(email),
getFileItems(formData));
if (error != null) {
return error;