parent
46af786516
commit
389e423850
@ -1,3 +1,4 @@
|
||||
import fs from "fs";
|
||||
import nodemailer from 'nodemailer';
|
||||
import { MailOptions } from 'nodemailer/lib/json-transport';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
@ -28,10 +29,14 @@ export class Mailer {
|
||||
|
||||
public async sendResetMail(to_address: string, token: String) {
|
||||
const reset_link = `${config.app_url}/reset/${token}`
|
||||
let body = fs.readFileSync(__dirname + '/static/mail_templates/pw-reset.html', { encoding: 'utf8' });
|
||||
|
||||
body = body.replace("{{reset_link}}", reset_link).replace("{{recipient_mail}}", to_address).replace("{{copyright_owner}}", "LfK!").replace("{{link_imprint}}", `${config.app_url}/imprint`).replace("{{link_privacy}}", `${config.app_url}/privacy`);
|
||||
|
||||
const mail: MailOptions = {
|
||||
to: to_address,
|
||||
subject: "LfK! Password Reset",
|
||||
html: `<b>${reset_link}</b>`
|
||||
html: body
|
||||
};
|
||||
await this.sendMail(mail);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user