Add image to freemarker template for mail?

爷,独闯天下 提交于 2020-01-04 16:26:43

问题


Im using spring email with freemarker template engine to send email to customers. As part of the signature I would like to add an image, but can't seem to get the template to find the image. The email appears with an image icon, not the actual image. Any ideas?

In email-html.ftl :

<font color="#636466">
  With kind regards,<br /><br />
</font>
<font color="#00747B">
 Name of firm<br />
</font>
<br />
<img src="/images/icon.gif" />

The image is available at /servername/contextroot/images/icon.gif


回答1:


You can't use relative image URLs in an HTML email - there's nothing for them to be relative to. You need to change your template to use a fully-qualified URL.

You can also, I believe, embed image data within the email, but that's a whole different question.



来源:https://stackoverflow.com/questions/9208027/add-image-to-freemarker-template-for-mail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!