如何将html图像添加到速度模板文件中以发送电子邮件? [英] How to add html image in to velocity template file to send email?

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

问题描述

我将此包含在我的力度文件中。但它没有用,

I include this in my velocity file. but it is not working,

< img src="cid:src/resources/imageContent.jpg" />


推荐答案

您可以按照指南此处

例如,在你的Velocity模板文件中试试这个:

For example, try this in your Velocity template file:

<img src = "cid:${cid}" alt = "Foo">

在您的Java代码中,尝试:

And in your Java code, try:

URL url = new URL("image.png");
String cid = email.embed(url, "Foo");
Map model = new HashMap();
model.put("cid", cid);

这篇关于如何将html图像添加到速度模板文件中以发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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