需求:使用freemaker模板发送邮件,邮件内容里中有图片。
1、图片最好放在classpath路径下,方便获取
ClassPathResource img = new ClassPathResource("conf/logo.png");
2、addInline方法,一定要在setText方法之后执行,不然图片显示不出来。具体原因我不清楚。
messageHelper.setText(html, true);
ClassPathResource img = new ClassPathResource("conf/logo.png");
messageHelper.addInline("image", img);