Using the ssh framework, the background sends an html message to the registered user, the chinese character title is normal, but the message contents.

57 5

To solve the problem,

ApplicationContext context=new ClassPathXmlApplicationContext("email.xml");
 JavaMailSender mailSender=(JavaMailSender)context.getBean("mailSender");
 MimeMessage mailMessage=mailSender.createMimeMessage();
 MimeMessageHelper messgaeHelper=new MimeMessageHelper(mailMessage);
 messgaeHelper.setTo(user.getEmail());
 messgaeHelper.setFrom("yiqiyigo@163.com");
 messgaeHelper.setSubject("欢迎您注册XX网!");
 messgaeHelper.setText("<html><head></head><body><table><tr><td><b>亲爱的"+user.getUsername()+":</b></td></tr><tr><td>您已经成功注册成为XX网大家庭和一员!希望XX网带给您不一样的体验!</td></tr></table></body></html>",true);
 mailSender.send(mailMessage);
2 Answers

121 1
...