Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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 17 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.