### Question:
MailService { public void sendHtmlInlinePhotoMail(String to, String subject, String content, String srcPath, String srcId) throws MessagingException { MimeMessage message = javaMailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setFrom(from); helper.setTo(to); helper.setSubject(subject); helper.setText(content, true); FileSystemResource fileSystemResource = new FileSystemResource(new File(srcPath)); helper.addInline(srcId, fileSystemResource); javaMailSender.send(message); }  void sendTextMail(String to, String subject, String content); void sendHtmlMail(String to, String subject, String content); void sendAttachmentMail(String to, String subject, String content, String[] filePathList); void sendHtmlInlinePhotoMail(String to, String subject, String content, String srcPath, String srcId);  }### Answer:
@Test public void sendHtmlInlinePhotoMailTest() throws MessagingException { String srcPath = "/Users/qufei/Documents/study/SpringBoot-WebApi/chapter6/img/pic18.jpg"; String srcId = "pic18"; String content = "<html>" + "<body>" + "<h2>hello，这是Spring Boot发送的一封HTML内嵌图片的邮件</h2>" + "<img src=\'cid:"+ srcId +"\'></img>" + "</body></html>"; mailService.sendHtmlInlinePhotoMail(to, "发送图片邮件", content, srcPath, srcId); }