From f7fb2de8dcded3ae5ed243456896a287d132e251 Mon Sep 17 00:00:00 2001 From: Alex Yang <32620988+DatProJack@users.noreply.github.com> Date: Tue, 23 Jul 2024 22:25:30 -0400 Subject: [PATCH 1/2] html email function --- src/services/ses/ses-utils.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/services/ses/ses-utils.ts b/src/services/ses/ses-utils.ts index bb6bc78..c7bcc16 100644 --- a/src/services/ses/ses-utils.ts +++ b/src/services/ses/ses-utils.ts @@ -38,3 +38,30 @@ export function sendEmail( }) .promise(); } + +export function sendHTMLEmail( + emailId: string, + subject: string, + emailHtml: string +): Promise { + return ses + .sendEmail({ + Destination: { + ToAddresses: [emailId], + }, + Message: { + Body: { + Html: { + Data: emailHtml, + }, + }, + Subject: { + Data: subject, + }, + }, + Source: Config.OUTGOING_EMAIL_ADDRESSES.Enum[ + "no-reply@reflectionsprojections.org" + ], + }) + .promise(); +} From 7921a5b0b6d805826b36036a2805aee71d732dd5 Mon Sep 17 00:00:00 2001 From: Alex Yang <32620988+DatProJack@users.noreply.github.com> Date: Tue, 23 Jul 2024 23:30:56 -0400 Subject: [PATCH 2/2] mustaches templates --- package.json | 1 + src/templates/templates.ts | 52 ++++++++++++++++++++++++++++++++++++++ yarn.lock | 5 ++++ 3 files changed, 58 insertions(+) create mode 100644 src/templates/templates.ts diff --git a/package.json b/package.json index b0f744e..23815c8 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "mongodb-memory-server": "^9.3.0", "mongoose": "^8.2.3", "morgan": "^1.10.0", + "mustache": "^4.2.0", "passport": "^0.7.0", "passport-google-oauth20": "^2.0.0", "ts-node": "^10.9.2", diff --git a/src/templates/templates.ts b/src/templates/templates.ts new file mode 100644 index 0000000..8be7c67 --- /dev/null +++ b/src/templates/templates.ts @@ -0,0 +1,52 @@ +const templates = { + SPONSOR_VERIFICATION: ` + + + + + + Verification Code + + + +
+

Here is your verification code:

+
{{code}}
+
+ + `, +}; + +export default templates; diff --git a/yarn.lock b/yarn.lock index 05b8db9..1958127 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6027,6 +6027,11 @@ ms@2.1.3, ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +mustache@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz"