Sistemato invio email customizzato
This commit is contained in:
@@ -270,6 +270,11 @@ public class MailService {
|
|||||||
return MailService.readParameter(multiDBTransactionManager, fromEmail);
|
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 {
|
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);
|
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);
|
testoEmailCustom = changeVariableParts(testoEmailCustom, dati.get(0), nomeUtente);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sendMail(customData.getEmailMittente(), dati.get(0).getEmailDestinatario(), oggettoEmailCustom, testoEmailCustom);
|
sendMail(customData.getEmailMittente(), nomeUtente, dati.get(0).getEmailDestinatario(), "", oggettoEmailCustom, testoEmailCustom);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
erroreMessage.append(dati.get(0).getRagSoc() + " " + e.getMessage() + CommonConstants.A_CAPO);
|
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
|
private String changeRepeatedText(String text, List<CustomEmailDTO.CustomEmailRowDTO> dati, String
|
||||||
nomeUtente) {
|
nomeUtente) {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
String patternText = text.substring(text.indexOf("{") + 1, text.indexOf("}"));
|
if (text.indexOf("{") > 0){
|
||||||
for (CustomEmailDTO.CustomEmailRowDTO var : dati) {
|
String patternText = text.substring(text.indexOf("{") + 1, text.indexOf("}"));
|
||||||
stringBuilder.append(changeVariableParts(patternText, var, nomeUtente) + CommonConstants.A_CAPO);
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public class SystemController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SecretKeyCacheComponent secretKeyCacheComponent;
|
private SecretKeyCacheComponent secretKeyCacheComponent;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
private RequestDataDTO requestDataDTO;
|
private RequestDataDTO requestDataDTO;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user