### Question:
SendMail { public void sendtemplateHtmlMail(String subject, String to, String name) { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); helper.setSubject(subject); helper.setTo(to); helper.setFrom(from); String filepath = "C:\\Users\\Administrator\\Desktop\\ocly.png"; FileSystemResource resource = new FileSystemResource(new File(filepath)); String filename = filepath.substring(filepath.lastIndexOf(File.separator)); helper.addAttachment(filename, resource); Context context = new Context(); context.setVariable("name", name); String templateHtml = templateEngine.process("emailTemplate", context); log.info("来看看模板长啥样 {}",templateHtml); helper.setText(templateHtml, true); helper.addInline("ocly", resource); javaMailSender.send(mimeMessage); log.info("模板邮件发送成功"); } catch (MessagingException e) { log.error("模板邮件发送失败"); } }  void sendSimpleMail(String subject, String to, String context); void sendFileMail(String subject, String to, String context, String filepath); void sendHtmlMail(String subject, String to, String context); void sendtemplateHtmlMail(String subject, String to, String name); void sendstaticMail(String subject, String to, String context, String filepath, String fileid);  }### Answer:
@Test public void hellomaiTemplate() throws Exception { sendMail.sendtemplateHtmlMail("你好，模板邮件加附件加图片","1193889747@qq.com","Bocly"); }