Now also sending txt mail body
continuous-integration/drone/pr Build is passing Details

ref #118
This commit is contained in:
Nicolai Ort 2021-01-26 18:45:19 +01:00
parent d3647e3399
commit b92f633d68
1 changed files with 4 additions and 4 deletions

View File

@ -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);
}