KEYCLOAK-3089 Change email subject encoding to utf-8
This commit is contained in:
parent
5474496867
commit
7bdccc21b2
1 changed files with 2 additions and 5 deletions
|
@ -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;
|
||||||
|
@ -33,7 +32,6 @@ import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeBodyPart;
|
import javax.mail.internet.MimeBodyPart;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMultipart;
|
import javax.mail.internet.MimeMultipart;
|
||||||
import javax.mail.internet.MimeUtility;
|
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
@ -109,11 +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(MimeUtility.encodeText(subject, "utf-8", "B"));
|
msg.setSubject(subject, "utf-8");
|
||||||
|
|
||||||
msg.setContent(multipart);
|
msg.setContent(multipart);
|
||||||
msg.saveChanges();
|
msg.saveChanges();
|
||||||
msg.setSentDate(new Date());
|
msg.setSentDate(new Date());
|
||||||
|
|
Loading…
Reference in a new issue