feat: Implement draft version of reset password email (#949)
This commit is contained in:
12
packages/backend/src/helpers/compile-email.ee.ts
Normal file
12
packages/backend/src/helpers/compile-email.ee.ts
Normal 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;
|
14
packages/backend/src/helpers/mailer.ee.ts
Normal file
14
packages/backend/src/helpers/mailer.ee.ts
Normal 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;
|
Reference in New Issue
Block a user