Код: Выделить всё
public static void sendEmail(String to, String cc, String subject, String content) throws IOException {
LOG.info(ESAPIValidation.sanitizeParam((String.format("EmailUtil.sendEMail() \n To: %s\n Subjet: %s \n Content: %s", to, subject, content))));
String host = ApplicationUtil.getProperty(ApplicationConstants.AL_WS_MAIL_HOST);
String port = ApplicationUtil.getProperty(ApplicationConstants.AL_WS_MAIL_PORT);
String from = ApplicationUtil.getProperty(ApplicationConstants.AL_WS_MAIL_FROM);
String defaultToAdd = ApplicationUtil.getProperty(ApplicationConstants.AL_WS_DEFAULT_MAIL);
String emailSystemPrefix = ApplicationUtil.getProperty(ApplicationConstants.EMAIL_PREFIX);
if (StringUtil.isNullOrEmpty(emailSystemPrefix)) {
emailSystemPrefix = "";
} else {
emailSystemPrefix = emailSystemPrefix + " - ";
}
Properties properties = System.getProperties();
properties.setProperty("mail.smtp.host", host);
properties.setProperty("mail.smtp.port", port);
Session session = Session.getDefaultInstance(properties);
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
addToList(message, to);
addCCList(message, cc);
if(cc == null || (cc != null && !cc.equals(defaultToAdd)))
addCCList(message, defaultToAdd);
content = addFooter(content);
message.setSubject(emailSystemPrefix + subject);
message.setContent(content.replace("textarea", "div"), "text/html; charset=utf-8");
Transport.send(message);
} catch (AddressException addressException) {
LOG.warn("EmailUtil.triggerDBFailureMail() AddressException ", addressException);
} catch (MessagingException messageException) {
LOG.warn("EmailUtil.triggerDBFailureMail() MessagingException ", messageException);
}
}
Неправильная нейтрализация последовательностей CRLF («CRLF Injection» ')(CWE ID 93)
включено
Код: Выделить всё
message.setSubject(emailSystemPrefix + subject);
Подробнее здесь: https://stackoverflow.com/questions/631 ... de-in-java