将图像添加到邮件的freemarker模板? [英] Add image to freemarker template for mail?

查看:103
本文介绍了将图像添加到邮件的freemarker模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有freemarker模板引擎的春季电子邮件将电子邮件发送给客户.作为签名的一部分,我想添加一个图像,但似乎无法获得用于查找图像的模板.电子邮件中显示的是图像图标,而不是实际图像.有什么想法吗?

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?

在email-html.ftl中:

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" />

该图像位于/servername/contextroot/images/icon.gif

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

推荐答案

您不能在HTML电子邮件中使用相对图像URL-没有相对于它们相对的URL.您需要更改模板以使用完全限定的URL.

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.

这篇关于将图像添加到邮件的freemarker模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆