Merge pull request #2918 from chameleon82/issue/KEYCLOAK-3089-email-subject-internationalization

KEYCLOAK-3089 Change email subject encoding to utf-8/base64
This commit is contained in:
Stian Thorgersen 2016-06-08 07:07:37 +02:00
commit 819c42dad2

View file

@ -24,7 +24,6 @@ import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.services.ServicesLogger; import org.keycloak.services.ServicesLogger;
import javax.mail.Message;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.Multipart; import javax.mail.Multipart;
import javax.mail.Session; import javax.mail.Session;
@ -108,10 +107,10 @@ public class DefaultEmailSenderProvider implements EmailSenderProvider {
multipart.addBodyPart(htmlPart); multipart.addBodyPart(htmlPart);
} }
Message msg = new MimeMessage(session); MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from)); msg.setFrom(new InternetAddress(from));
msg.setHeader("To", address); msg.setHeader("To", address);
msg.setSubject(subject); msg.setSubject(subject, "utf-8");
msg.setContent(multipart); msg.setContent(multipart);
msg.saveChanges(); msg.saveChanges();
msg.setSentDate(new Date()); msg.setSentDate(new Date());