Skip to content

Commit

Permalink
Merge pull request #44 from kentibs/feat/newletter
Browse files Browse the repository at this point in the history
Feat/newletter
  • Loading branch information
Tibz-Dankan authored Feb 14, 2024
2 parents ea8bf6c + c2691b1 commit 036f76c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controllers/newsLetterController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export const postNewsLetter = asyncHandler(
new AppError("Please provide at least one recipient", 400);
}

// TODO:capture images here

// TODO: implement the newsLetter sending functionality

res.status(201).json({
Expand Down
19 changes: 19 additions & 0 deletions src/utils/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,23 @@ export class Email {
);
await this.sendHtml(html, "Initial Signup Token");
}

async sendNewLetter(
firstName: string,
title: string,
body: string,
images: any[]
) {
const html = pug.renderFile(
path.join(__dirname, "../views/email/newsLetter.pug"),
{
subject: this.subject,
firstName: firstName,
title: title,
body: title,
images: images,
}
);
await this.sendHtml(html, "Welcome to SEG MUK");
}
}
19 changes: 19 additions & 0 deletions src/views/email/newsLetter.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends baseEmail

block content
p Hi #{firsName},
p #{title}
p #{body}
p #{images}
table.btn.btn-primary(role='presentation', border='0', cellpadding='0', cellspacing='0')
tbody

tr
td(align='left')
table(role='presentation', border='0', cellpadding='0', cellspacing='0')
tbody
tr
td
a(href=`https://dav-safaris.com/login`, target='_blank') Unsubscribe
p If you need any help, please don't hesitate to contact us!
p [email protected]

0 comments on commit 036f76c

Please sign in to comment.