Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Email 插件是为 egg 提供 email 邮件服务的功能
egg-email 版本 | egg 1.x |
---|---|
1.x | 😁 |
0.x | ❌ |
$ npm install egg-email --save
// config/plugin.js
exports.email = {
enable: true,
package: 'egg-email',
};
通过config/plugins.js
来启动 Email 插件
exports.email = {
enable: true,
package: 'egg-email',
}
在 config/config.${env}.js
配置各个环境的邮件服务连接信息;
exports.email = {
client: {
host: 'smtp.qq.com',
secureConnection: true,
port: 465,
auth: {
user: 'test_user',
pass: 'test_pass'
}
}
}
使用方法:
const mailOptions = {
from: 'qoderplus@gmail.com',
to: 'test_user@qq.com',
subject: 'hello world',
html: `<a href = 'link'>点击链接进行验证</a>`
};
app.email.sendMail(mailOptions, (error, response) => {
if (error) {
console.log('error:', error);
} else {
console.log('email sent: ' + response.message);
}
app.email.close();
});
exports.email = {
clients: {
mail1: {
host: 'smtp.qq.com',
secureConnection: true,
port: 465,
auth: {
user: 'test_user',
pass: 'test_pass'
},
},
},
//所有的邮件服务配置默认值
default: {
}
};
使用方法:
const client1 = app.email.get('mail1');
//...
const client2 = app.email.get('mail2');
如果开启了 config.email.app = true
,则会在 app 上注入 [nodemailer] 客户端 的 Singleton 单例。
如果开启了 config.email.agent = true
,则会在 agent 上注入 [nodemailer] 客户端 的 Singleton 单例。
请到 config/config.default.js 查看详细配置项说明。
请到 egg issues 异步交流。
FAQs
egg 邮件服务
The npm package egg-email receives a total of 21 weekly downloads. As such, egg-email popularity was classified as not popular.
We found that egg-email demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.