带 UI 的 Java 电子邮件模板?
我的网站是用 Java/JSP 构建的,需要发送大约 5-10 封预定义的电子邮件,然后向注册者发送临时电子邮件。我希望避免“重新发明轮子”。我希望电子邮件模板可以通过所见即所得类型的 gui 进行简单管理。到目前为止,我读到的所有内容(Velocity、Freemarker 等)都适用于预定义模板,没有 UI,并且对临时电子邮件没有真正的帮助。
只是好奇我最好自己写一些东西还是有什么可以帮助的?
My website, built in Java/JSP, will need to send about 5-10 predefined emails and then adhoc emails to those who are registered. I'm looking to avoid 'reinventing the wheel'. I'd prefer if the email templates could be simply managed with a WYSIWYG type of gui. So far everything I've read about (Velocity, Freemarker, etc) are OK for the predefined templates, don't have a UI and don't really help with adhoc emails.
Just curious am I best off writing something myself or is there something out there that can help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么需要 GUI 来制作电子邮件?最好使电子邮件内容尽可能简单,而不是在其中嵌入 HTML 标签。如果您的用户决定使用纯文本/文本打开电子邮件,那么他们看到的只是一堆丑陋的标签。
使用 Velocity 或 Freemarker 等模板引擎是制作电子邮件模板的方法。即使使用临时电子邮件,您也可能希望使用电子邮件模板保持页眉和页脚相同,并且可以将正文内容替换为临时消息。
在我的项目中,我有一个使用 Velocity 的电子邮件模板,如下所示:-
exception-email.vm file
为了将构建的电子邮件作为字符串获取,我执行以下操作:-
当然,我正在使用 Spring连接到
velocityEngine
:-Why do you need a GUI to craft your emails? It is best to keep the email content as simple as possible instead of embedding HTML tags in it. If your user decides to open the email with plain/text, then all they see are just bunch of ugly tags.
Using template engine such as Velocity or Freemarker is the way to go to craft your email template. Even with adhoc emails, you may want to keep the header and footer to be the same using the email template and you can swap out the body content with your adhoc messages.
In my project, I have an email template using Velocity, like this:-
exception-email.vm file
To get the constructed email as string, I do the following:-
Granted, I'm using Spring to wire in
velocityEngine
:-