如何将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);