ftl文件模板图片,将图像添加到邮件的freemarker模板?

本文介绍了在使用Spring和Freemarker模板发送HTML邮件时遇到的问题,即邮件中的图片无法正常显示,只显示为图标。解决方法是使用完全限定的URL代替相对URL来引用图片,或者考虑将图片数据内联到邮件中。此外,还提醒了内联图片是另一个复杂的话题。
摘要由CSDN通过智能技术生成

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 :

With kind regards,

Name of firm

icon.gif

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

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值