updated code for new package

This commit is contained in:
Alex Holliday
2024-07-19 20:02:01 -07:00
parent f02a6b31fa
commit fdb59866b3
2 changed files with 3 additions and 3 deletions

View File

@@ -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",

View File

@@ -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;
};