From 5db868bb56b50023b1f4a477562326dfefd4b49d Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 2 Nov 2015 08:57:12 -0300 Subject: [PATCH] Return to java 1.7 --- pom.xml | 4 ++-- .../java/com/wisemapping/mail/Mailer.java | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 63eeccd4..5c191319 100644 --- a/pom.xml +++ b/pom.xml @@ -119,8 +119,8 @@ maven-compiler-plugin 3.1 - 1.8 - 1.8 + 1.7 + 1.7 UTF-8 diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java index be7fc416..e935b577 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java @@ -53,16 +53,21 @@ public final class Mailer { public void sendEmail(final String from, final String to, final String subject, final Map model, @NotNull final String templateMail) { + final MimeMessagePreparator preparator = + new MimeMessagePreparator() { + public void prepare(MimeMessage mimeMessage) + throws Exception { + final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); + message.setTo(to); + message.setFrom(from); + message.setSubject(subject); - this.mailSender.send(mimeMessage -> { - final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); - message.setTo(to); - message.setFrom(from); - message.setSubject(subject); + final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model); + message.setText(messageBody, true); + } + }; - final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model); - message.setText(messageBody, true); - }); + this.mailSender.send(preparator); } public void setMailSender(JavaMailSender mailer) {