简体   繁体   English

在Java中配置邮件模板和元数据字段

[英]configuring mail templates and metadata fields in java

I am working on one application which has lot of mailing logic depending on the workflow triggered by the user actions. 我正在开发一个应用程序,该应用程序具有大量的邮件逻辑,具体取决于用户操作触发的工作流程。

I am just wondering if there is any elegant way to store all metadata fields related to mail object (from mail id, to mail id, cc mail id, reply to mail id, subject, mail content) to database and map them with workflow ids. 我只是想知道是否存在任何一种优雅的方式来将与邮件对象相关的所有元数据字段(从邮件ID,邮件ID,抄送邮件ID,抄送邮件ID,回复邮件ID,主题,邮件内容)存储到数据库并使用工作流ID进行映射。 Also, all these fields could be picked up from logged in user's context object eg 同样,所有这些字段都可以从登录用户的上下文对象中获取,例如

from mail id - logged in user to mail id - logged in user's friend cc mail id - some mailing list subject - has sent you some sticker content - hi , your friend , has sent you one sticker. 从邮件ID-登录用户到邮件ID-登录用户的朋友cc邮件ID-一些邮件列表主题-已向您发送了一些标签内容-嗨,您的朋友已向您发送了一个标签。 Sticker id - . 贴纸ID-。

Questions - 1. Is there any library/framework/utility which allows configuring all such fields? 问题-1.是否存在允许配置所有此类字段的库/框架/实用程序? 2. Is there any recommendation on handling macro fields (enclosed within <>)? 2.关于处理宏字段(括在<>中)有什么建议吗?

PS - I have 50 such mail templates so velocity would not be a good idea. PS-我有50个这样的邮件模板,所以速度不是一个好主意。 Moreover, velocity doesn't allow templates to be stored in database and I am clueless about how to configure to,cc,bcc mail address using velocity template. 而且,速度不允许模板存储在数据库中,我不了解如何使用速度模板配置到,cc,bcc邮件地址。

Velocity is a right tool, but it won't do it all for you. 速度一种正确的工具,但它并不能为您完成所有操作。 Think about about a template like any view in MVC. 考虑像MVC中的任何视图一样的模板。 You need to supply the data (model) for it by yourself and connect the model with the template (view) with controller. 您需要自己提供数据(模型),并将模型与带有控制器的模板(视图)连接。

Regarding the database - spring has dedicated API for keeping templates in the DB. 关于数据库-spring具有专用的API,用于将模板保留在DB中。 The official documentation ( Reference , Javadoc ) doesn't help much here, but see this answer for sample configuration. 官方文档( ReferenceJavadoc )在这里并没有多大帮助,但是请参阅此答案以获取示例配置。

Velocity has nothing to do with sending actual e-mails, use Java Mail API for that. Velocity与发送实际电子邮件无关,为此使用Java Mail API。 You need to supply To, CC, BCC fields by yourself, but it shouldn't be hard thing to do. 您需要自己提供“收件人”,“抄送”,“密件抄送”字段,但这并不难。

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

相关问题 配置Java HBS查找部分模板的位置 - Configuring where Java HBS looks for partial templates 使用Rome Java API访问元数据字段 - Using the Rome Java API to access metadata fields 未从 blob 上的 azure java sdk 收到元数据字段 - Metadata fields not received from azure java sdk on a blob 是否可以通过Java API检索Docusign模板或Power Form字段 - Is it possible to retrieve Docusign Templates or Power Form fields through Java API 有没有办法通过netbeans代码模板打印Java类字段? - Is there a way to print java class fields by netbeans code templates? 使用JavaMailSender在Spring中配置Mail - Configuring Mail in Spring using JavaMailSender 获取文件元数据字段 - getting file metadata fields Java:打开默认邮件应用程序并创建新邮件并填充“收件人”和“主题”字段 - Java: Open default mail application and create new mail and populate To and Subject fields Freemarker 不在邮件模板上显示图像 - Freemarker is not displaying images on mail templates 将 Java 数据 Class 转换为前端的字段数组/元数据(类似于 Swagger 数据模型/模式)? - Convert Java Data Class to Array of Fields/Metadata for frontend (Similar to Swagger Data Model/Schema)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM