mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-24 06:57:56 +01:00
Fix email encodding problem.
This commit is contained in:
parent
641bcbbe17
commit
accf252e78
@ -26,7 +26,7 @@ import org.springframework.mail.javamail.JavaMailSender;
|
|||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
import org.springframework.mail.javamail.MimeMessagePreparator;
|
import org.springframework.mail.javamail.MimeMessagePreparator;
|
||||||
|
|
||||||
import javax.mail.internet.MimeMessage;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class Mailer {
|
public final class Mailer {
|
||||||
@ -54,17 +54,14 @@ public final class Mailer {
|
|||||||
public void sendEmail(final String from, final String to, final String subject, final Map<String, Object> model,
|
public void sendEmail(final String from, final String to, final String subject, final Map<String, Object> model,
|
||||||
@NotNull final String templateMail) {
|
@NotNull final String templateMail) {
|
||||||
final MimeMessagePreparator preparator =
|
final MimeMessagePreparator preparator =
|
||||||
new MimeMessagePreparator() {
|
mimeMessage -> {
|
||||||
public void prepare(MimeMessage mimeMessage)
|
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage, StandardCharsets.UTF_8.name());
|
||||||
throws Exception {
|
message.setTo(to);
|
||||||
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
|
message.setFrom(from);
|
||||||
message.setTo(to);
|
message.setSubject(subject);
|
||||||
message.setFrom(from);
|
|
||||||
message.setSubject(subject);
|
|
||||||
|
|
||||||
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
|
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
|
||||||
message.setText(messageBody, true);
|
message.setText(messageBody, true);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mailSender.send(preparator);
|
this.mailSender.send(preparator);
|
||||||
|
Loading…
Reference in New Issue
Block a user