简体   繁体   English

替换HTML邮件中的符号

[英]Replace symbols in HTML mail

I generated template using HTML mail generator: 我使用HTML邮件生成器生成了模板:

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" 
........
<table role="presentation">.......<span style="font-size: 20px;">&#x423;&#x441;&#x43F;&#x435;&#x448;&#x43D;&#x430; &#x440;&#x435;&#x433;&#x438;&#x441;&#x442;&#x440;&#x430;&#x446;&#x438;&#x44F;......</table>
.........
</html>

But I need to send different content like name and address into each mail. 但是我需要在每个邮件中发送不同的内容,例如姓名和地址。 Currently the text is exceeded as you can see I suppose for compatibility reasons. 如您所见,出于兼容性原因,您目前可以看到该文本。 Is it a good practice to set for example some using value and replace the symbols each time with Java? 设置(例如)使用值并每次用Java替换符号是一种好习惯吗? Also do you know what is the encoding of the above symbols? 您还知道上述符号的编码是什么吗? Can you guide me why would be the best solution for this? 您能指导我为什么是最好的解决方案吗?

You Can use template engines for these kind of requirements 您可以将模板引擎用于此类要求

There are multiple template engines are available like 有多个模板引擎可用,例如

  1. Apache Velocity 阿帕奇速度
  2. Apache FreeMarker Apache FreeMarker
  3. Thymeleaf 胸腺
  4. Pebble 卵石

But I feel Apache FreeMarker is better. 但是我觉得Apache FreeMarker更好。 Kindly find below link for details Apache FreeMarker with Example 请在下面的链接中获取有关Apache FreeMarker的详细信息以及示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM