feat: Implement draft version of reset password email (#949)

This commit is contained in:
Ömer Faruk Aydın
2023-02-24 00:25:10 +01:00
committed by GitHub
parent bd02b7574a
commit a0815b06a6
9 changed files with 141 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
import * as path from 'path';
import * as fs from 'fs';
import * as handlebars from 'handlebars';
const compileEmail = (emailPath: string, replacements: object = {}): string => {
const filePath = path.join(__dirname, `../views/emails/${emailPath}.ee.hbs`);
const source = fs.readFileSync(filePath, 'utf-8').toString();
const template = handlebars.compile(source);
return template(replacements);
};
export default compileEmail;

View File

@@ -0,0 +1,14 @@
import nodemailer from 'nodemailer';
import appConfig from '../config/app';
const mailer = nodemailer.createTransport({
host: appConfig.smtpHost,
port: appConfig.smtpPort,
secure: appConfig.smtpSecure,
auth: {
user: appConfig.smtpUser,
pass: appConfig.smtpPassword,
},
});
export default mailer;