Skip to content

Commit 2f6a1a8

Browse files
Merge pull request #1240 from con2/fix/test-email-html-body
Add html body to test controller email sending
2 parents 91c36ac + ce27842 commit 2f6a1a8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

server/src/features/admin/emailTestController.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ export const postEmailTest = async (
6262
programItemId: programId,
6363
programItemStartTime: new Date().toISOString(),
6464
};
65+
const body = getEmailBodyAccepted("Test Program Item", mockNotification);
66+
const htmlBody = body.replaceAll("\n", "<br />");
6567
message = {
6668
from: config.server().emailSendFromAddress,
6769
to: email,
6870
subject: getEmailSubjectAccepted(),
69-
text: getEmailBodyAccepted("Test Program Item", mockNotification),
70-
html: getEmailBodyAccepted("Test Program Item", mockNotification),
71+
text: body,
72+
html: htmlBody,
7173
};
7274
} else if (notificationType === EmailNotificationTrigger.REJECTED) {
7375
const mockNotification: NotificationTask = {
@@ -76,12 +78,14 @@ export const postEmailTest = async (
7678
programItemId: programId,
7779
programItemStartTime: new Date().toISOString(),
7880
};
81+
const body = getEmailBodyRejected(mockNotification);
82+
const htmlBody = body.replaceAll("\n", "<br />");
7983
message = {
8084
from: config.server().emailSendFromAddress,
8185
to: email,
8286
subject: getEmailSubjectRejected(),
83-
text: getEmailBodyRejected(mockNotification),
84-
html: getEmailBodyRejected(mockNotification),
87+
text: body,
88+
html: htmlBody,
8589
};
8690
} else {
8791
return res.status(400).json({ message: "Invalid notification type" });

0 commit comments

Comments
 (0)