12345678910111213141516171819202122232425262728 |
- const _ = require('lodash');
- const assert = require('assert');
- /**
- * 重置密码
- * @param {Object} sender 发送人设置
- * @param {String} receiver 发送对象
- * @param {Object} params 模板参数
- */
- module.exports = (sender, receiver, params) => {
- assert(sender, '缺少发送人信息');
- const { from, user, pass } = sender;
- const auth = { user, pass };
- const mailConfig = {
- host: 'smtp.163.com',
- port: 465,
- secure: true,
- auth,
- };
- const { password } = params;
- const text = `【重置密码】密码重置成功! 您的新密码为:${password},若非本人操作,请忽略此信息。<${from}>`;
- const mailContext = {
- from: `"${from}" <${user}>`, // 邮件来源
- to: receiver, // 邮件发送到哪里,多个邮箱使用逗号隔开
- subject: `${from}-重置密码`, // 邮件主题
- html: text, // html类型的邮件正文
- };
- return { mailContext, mailConfig };
- };
|