Return to java 1.7

This commit is contained in:
Paulo Gustavo Veiga 2015-11-02 08:57:12 -03:00
parent a5ee4475e1
commit 5db868bb56
2 changed files with 15 additions and 10 deletions

View File

@ -119,8 +119,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.7</source>
<target>1.8</target> <target>1.7</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -53,16 +53,21 @@ public final class Mailer {
public void sendEmail(final String from, final String to, final String subject, final Map model, public void sendEmail(final String from, final String to, final String subject, final Map model,
@NotNull final String templateMail) { @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 String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model);
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); message.setText(messageBody, true);
message.setTo(to); }
message.setFrom(from); };
message.setSubject(subject);
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model); this.mailSender.send(preparator);
message.setText(messageBody, true);
});
} }
public void setMailSender(JavaMailSender mailer) { public void setMailSender(JavaMailSender mailer) {