springBoot 发送邮件图片不显示

解决方案

  • MimeMessageHelper 的执行顺序错了,先执行 setText() 然后执行 addInline() 添加图片
  • <img src="cid:p03"/>

    原因分析 官方文档

Inline resources are added to the MimeMessage by using the specified Content-ID (identifier1234 in the above example).   
The order in which you add the text and the resource are very important.   
Be sure to first add the text and then the resources.  
 If you are doing it the other way around, it does not work.

猜你喜欢

转载自www.cnblogs.com/eatandsleep/p/12207567.html