Maintain a resource file for the email template with placeholders - #40
Maintain a resource file for the email template with placeholders#40anuragSharma1112 wants to merge 4 commits into
Conversation
|
Hi @axymthr sir, I have cut new branch and again giving the PR |
|
Thanks. Please close the other PR. |
| import com.statusneo.vms.model.Employee; | ||
| import com.statusneo.vms.model.Visitor; | ||
| import com.statusneo.vms.util.EmailTemplateProcessor; | ||
| import org.springframework.stereotype.Service; |
| String body = templateProcessor.loadTemplate("hostNotification.txt", placeholders); | ||
|
|
||
| Email email = Email.of( | ||
| "noreply@company.com", |
| @@ -0,0 +1,80 @@ | |||
| package com.statusneo.vms.config; | |||
|
|
|||
|
Hi @axymthr sir please merge this Pull Request |
|
@anuragSharma1112 merging is blocked due to merge conflicts. Can you rebase from branch from develop and push? |
There was a problem hiding this comment.
These shouldn't be txt files. Use a standard template format. Since we already have JTE in this project use that instead.
There was a problem hiding this comment.
These shouldn't be txt files. Use a standard template format. Since we already have JTE in this project use that instead.
| sender: noreply@company.com | ||
| visitor-confirmation: | ||
| subject: Registration Successful | ||
| template: visitorConfirmation.txt |
There was a problem hiding this comment.
I'm not convinced about putting template location in here.
If you need to override it you'll still need to make code changes to add the new template and rebuild the application? what value does it add to put it in config?
|
|
||
| @Component | ||
| public class EmailTemplateProcessor { | ||
| public String loadTemplate(String templateName, Map<String, String> placeholders) { |
There was a problem hiding this comment.
All of this is unnecessary if we use JTE support. Spring/JTE should load it for you from standard class path location and do the rendering too.
Description
Added email template support for host notification.
Integrated hostNotification.txt template using EmailTemplateProcessor to dynamically generate email body with placeholders.
Fixes # (issue)
NA
Type of change
How Has This Been Tested?
Checklist:
Screenshots (for UX changes):
NA
Additional Notes:
Template file hostNotification.txt added under src/main/resources/templates/.
Updated unit tests to mock EmailTemplateProcessor for host email generation.