egg-mail-template
v1.1.0
Published
Collect email templates in HTML and mount to app
Downloads
5
Readme
egg-mail-template
egg-mail-template是一个可以帮助你导入HTML邮件模板到egg的插件。
egg-mail-template is a plugin that can help you import your HTML email templates into egg.
安装 Install
npm i egg-mail-template --save
开启插件 Usage
// config/plugin.js
exports.mailTemplate = {
enable: true,
package: 'egg-mail-template',
};
你可以配合egg-mailer使用本插件,插件会读取固定目录下的HTML文件作为发送HTML邮件的模板,挂载至app下。
You can use this plugin with egg-mailer, this plugin will read your templates from a certain directory and mount them on app object.
获取模板的方式:
How to get the template:
const template = app.mailTemplates[fileNameInCamelCase];
配置 Configuration
参考配置:
// {app_root}/config/config.default.js
exports.mailTemplate = {
path: '', // path of directory which contains your html templates
}