From b92f633d68604636cecc5e9fdd0d6990b9cb83fe Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Tue, 26 Jan 2021 18:45:19 +0100 Subject: [PATCH] Now also sending txt mail body ref #118 --- src/mailer.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mailer.ts b/src/mailer.ts index 80c22f5..bc2281d 100644 --- a/src/mailer.ts +++ b/src/mailer.ts @@ -29,14 +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 body_html = fs.readFileSync(__dirname + '/static/mail_templates/pw-reset.html', { encoding: 'utf8' }).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 body_txt = fs.readFileSync(__dirname + '/static/mail_templates/pw-reset.html', { encoding: 'utf8' }).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: body + text: body_txt, + html: body_html }; await this.sendMail(mail); }