public void send() {try { MimeMessage mailMessage = javaMailSender.createMimeMessage(); MimeMessageHelper messageHelper = new MimeMessageHelper(mailMessage); InputStream template = MailSender.class.getClassLoader().getResourceAsStream("maile.html"); Scanner scanner = new Scanner(template, "UTF-8"); String text = MessageUtil.formatMailContent(scanner.useDelimiter("\\A").next(),MessageUtil.formatMailContent(message,arg)); messageHelper.setFrom("buglife@buglife.cn"); messageHelper.setTo(to); messageHelper.setSubject("BugLife 注册提醒"); messageHelper.setText(text, true); this.mailMessage = mailMessage; new Thread(){ @Override public void run() { sendMessage(); } }.start();} catch (Exception e) { LOGGER.error(e.getMessage());}} private void sendMessage(){javaMailSender.send(mailMessage);