]> source.dussan.org Git - gitblit.git/commitdiff
send email subject utf-8 encoded 929/head
authorwilliam <william.fromtw@gmail.com>
Wed, 30 Sep 2015 14:50:38 +0000 (22:50 +0800)
committerwilliam <william.fromtw@gmail.com>
Wed, 30 Sep 2015 14:50:38 +0000 (22:50 +0800)
src/main/java/com/gitblit/service/MailService.java

index ae9727fc64c297ce957cf8f0ab89df050f056f8f..ec3a84ca186c933f72d210f637048e4c0b10d899 100644 (file)
@@ -37,6 +37,7 @@ import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeBodyPart;\r
 import javax.mail.internet.MimeMessage;\r
 import javax.mail.internet.MimeMultipart;\r
+import javax.mail.internet.MimeUtility;\r
 \r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
@@ -196,7 +197,8 @@ public class MailService implements Runnable {
                        }\r
 \r
                        message.setSentDate(new Date());\r
-                       message.setSubject(mailing.subject);\r
+                       // UTF-8 encode\r
+                       message.setSubject(MimeUtility.encodeText(mailing.subject, "utf-8", "B"));\r
 \r
                        MimeBodyPart messagePart = new MimeBodyPart();\r
                        messagePart.setText(mailing.content, "utf-8");\r