mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-23 22:47:57 +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.MimeMessagePreparator;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
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,
|
||||
@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);
|
||||
mimeMessage -> {
|
||||
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage, StandardCharsets.UTF_8.name());
|
||||
message.setTo(to);
|
||||
message.setFrom(from);
|
||||
message.setSubject(subject);
|
||||
|
||||
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
|
||||
message.setText(messageBody, true);
|
||||
}
|
||||
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
|
||||
message.setText(messageBody, true);
|
||||
};
|
||||
|
||||
this.mailSender.send(preparator);
|
||||
|
Loading…
Reference in New Issue
Block a user