问题
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