Sistemato invio email customizzato
This commit is contained in:
@@ -270,6 +270,11 @@ public class MailService {
|
||||
return MailService.readParameter(multiDBTransactionManager, fromEmail);
|
||||
}
|
||||
|
||||
public Message sendMail(String from, String fromName, String to, String cc, String subject, String msg) throws Exception {
|
||||
return sendMailPrimary(from, fromName, to, cc, null, subject, msg, false, false, null, null, null);
|
||||
}
|
||||
|
||||
|
||||
public Message sendMail(String to, String cc, String subject, String msg) throws Exception {
|
||||
return sendMailPrimary(null, null, to, cc, null, subject, msg, false, false, null, null, null);
|
||||
}
|
||||
@@ -662,7 +667,7 @@ public class MailService {
|
||||
testoEmailCustom = changeVariableParts(testoEmailCustom, dati.get(0), nomeUtente);
|
||||
|
||||
try {
|
||||
sendMail(customData.getEmailMittente(), dati.get(0).getEmailDestinatario(), oggettoEmailCustom, testoEmailCustom);
|
||||
sendMail(customData.getEmailMittente(), nomeUtente, dati.get(0).getEmailDestinatario(), "", oggettoEmailCustom, testoEmailCustom);
|
||||
} catch (Exception e) {
|
||||
erroreMessage.append(dati.get(0).getRagSoc() + " " + e.getMessage() + CommonConstants.A_CAPO);
|
||||
}
|
||||
@@ -693,13 +698,15 @@ public class MailService {
|
||||
private String changeRepeatedText(String text, List<CustomEmailDTO.CustomEmailRowDTO> dati, String
|
||||
nomeUtente) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String patternText = text.substring(text.indexOf("{") + 1, text.indexOf("}"));
|
||||
for (CustomEmailDTO.CustomEmailRowDTO var : dati) {
|
||||
stringBuilder.append(changeVariableParts(patternText, var, nomeUtente) + CommonConstants.A_CAPO);
|
||||
if (text.indexOf("{") > 0){
|
||||
String patternText = text.substring(text.indexOf("{") + 1, text.indexOf("}"));
|
||||
for (CustomEmailDTO.CustomEmailRowDTO var : dati) {
|
||||
stringBuilder.append(changeVariableParts(patternText, var, nomeUtente) + CommonConstants.A_CAPO);
|
||||
}
|
||||
text = text.replaceAll(patternText, stringBuilder.toString());
|
||||
text = text.replaceAll("\\{", "");
|
||||
text = text.replaceAll("}", "");
|
||||
}
|
||||
text = text.replaceAll(patternText, stringBuilder.toString());
|
||||
text = text.replaceAll("\\{", "");
|
||||
text = text.replaceAll("}", "");
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ public class SystemController {
|
||||
|
||||
@Autowired
|
||||
private SecretKeyCacheComponent secretKeyCacheComponent;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user