业务层合并电子邮件模板的最佳解决方案是什么

发布于 2024-09-27 10:05:53 字数 216 浏览 9 评论 0原文

我正在询问一个非常“简单”问题的最佳解决方案。

今天,我的前端/网站上有电子邮件模板文件以及发送这些电子邮件的逻辑。

现在,我正在通过删除 BL 的所有邮件逻辑来改进我的代码。 所以我的想法是让我的业务层(BL)项目负责在发生某些业务行为时发送电子邮件,而不是前端。

我的问题是,我仍然必须能够更改模板,而无需编译 BL 项目。

你有什么好的解决办法吗?

I'm asking the best solution for a very 'simple' problem.

Today, I have emails templates files and also the logic for sending those emails, on my frontend/website.

Now, I'm improving my code by removing any Mail logic to my BL.
So my idea is to have my Business Layer (BL) project, responsible for sending emails, if some business behaviour occur, and not the frontend.

The question that I have, is that I must still be able to change the templates without requiring to compile the BL project.

Do you have any good solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

并安 2024-10-04 10:05:53

对于这个问题有多种解决方案,其中之一是将模板保存在Xml文件中。

There are several solutions for this problem , One of them is to save the template in Xml file.

情域 2024-10-04 10:05:53

您只需在 BL 项目中添加文件夹并将邮件模板放入其中即可。然后将每个文件(邮件模板)的构建操作设置为“内容”。只需标记一个文件,转到属性,然后您将看到“构建操作”。

另一个解决方案是将它们保存在数据库中(如果您在项目中使用数据库)。

You can simply add folder in your BL project and put your mail templates in it. Then set build action of each file (mail template) to "Content". Just mark a file, go to properties, then you will see "Build action".

Another solution is to have them saved in database (if you use DB in your project).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文