diff --git a/package.json b/package.json index 77849fa..c9ce3d7 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,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/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(); +} 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 59088b4..283277c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6167,6 +6167,11 @@ ms@2.1.3, ms@^2.1.1: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" 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"