Update:
-delen van agenda toegevoegd -popup aangepast -accepteren van uitnodiging toegevoegd -koppelen van gebruiker aan bedrijf -versturen van uitnodiging via mail
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package nl.veenm.paypoint.service;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
|
||||
@ApplicationScoped
|
||||
public class EmailTemplateService {
|
||||
|
||||
public String loadTemplate(String templatePath, Map<String, String> replacements) {
|
||||
try {
|
||||
String content = Files.readString(Path.of(templatePath), StandardCharsets.UTF_8);
|
||||
|
||||
for (Map.Entry<String, String> entry : replacements.entrySet()) {
|
||||
content = content.replace("{{" + entry.getKey() + "}}", entry.getValue());
|
||||
}
|
||||
|
||||
return content;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Kon e-mailtemplate niet inladen: " + templatePath, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user