From fdb59866b31dadcd0d2fbaa07aa2fbe900d648ca Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 19 Jul 2024 20:02:01 -0700 Subject: [PATCH] updated code for new package --- Server/index.js | 2 +- Server/service/emailService.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/index.js b/Server/index.js index 45f44d0f3..c1f6f1e9f 100644 --- a/Server/index.js +++ b/Server/index.js @@ -85,7 +85,7 @@ const startApp = async () => { app.use("/api/v1/mail", async (req, res) => { try { - const id = await req.emailSerivce.buildAndSendEmail( + const id = await req.emailService.buildAndSendEmail( "welcomeEmailTemplate", { name: "Alex", diff --git a/Server/service/emailService.js b/Server/service/emailService.js index 81acb5819..97982a576 100644 --- a/Server/service/emailService.js +++ b/Server/service/emailService.js @@ -2,7 +2,7 @@ const fs = require("fs"); const path = require("path"); const nodemailer = require("nodemailer"); const { compile } = require("handlebars"); -const { mjml2html } = require("mjml"); +const mjml2html = require("mjml"); /** * Represents an email service that can load templates, build, and send emails. @@ -68,7 +68,7 @@ class EmailService { buildAndSendEmail = async (template, context, to, subject) => { const buildHtml = (template, context) => { const mjml = this.templateLookup[template](context); - const html = mjml2html(mjml); + const html = mjml2html(mjml).html; return html; };