We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d431af commit b58c3fdCopy full SHA for b58c3fd
apps/OpenSignServer/Utils.js
@@ -17,3 +17,24 @@ export const color = [
17
'#66ccff',
18
'#ffffcc',
19
];
20
+
21
+export function replaceMailVaribles(subject, body, variables) {
22
+ let replacedSubject = subject;
23
+ let replacedBody = body;
24
25
+ for (const variable in variables) {
26
+ const regex = new RegExp(`{{${variable}}}`, 'g');
27
+ if (subject) {
28
+ replacedSubject = replacedSubject.replace(regex, variables[variable]);
29
+ }
30
+ if (body) {
31
+ replacedBody = replacedBody.replace(regex, variables[variable]);
32
33
34
35
+ const result = {
36
+ subject: replacedSubject,
37
+ body: replacedBody,
38
+ };
39
+ return result;
40
+}
0 commit comments