All Projects → xjh22222228 → egg-mailer

xjh22222228 / egg-mailer

Licence: MIT license
🥚 mailer plugin for egg

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to egg-mailer

egg-session-redis
redis store for egg session
Stars: ✭ 41 (+78.26%)
Mutual labels:  egg, egg-plugin
egg-kafkajs
☎️kafka plugin for eggjs
Stars: ✭ 26 (+13.04%)
Mutual labels:  egg, egg-plugin
Egg Redis
redis plugin for egg
Stars: ✭ 234 (+917.39%)
Mutual labels:  egg, egg-plugin
Egg Security
Security plugin for egg, force performance too.
Stars: ✭ 204 (+786.96%)
Mutual labels:  egg, egg-plugin
egg-weapp-sdk
Egg的微信小程序登录会话管理SDK
Stars: ✭ 111 (+382.61%)
Mutual labels:  egg, egg-plugin
Egg Socket.io
socket.io plugin for eggjs.
Stars: ✭ 209 (+808.7%)
Mutual labels:  egg, egg-plugin
egg-kafka-node
kafka plugin for egg.js
Stars: ✭ 36 (+56.52%)
Mutual labels:  egg, egg-plugin
Egg View Vue
vue view plugin for egg
Stars: ✭ 136 (+491.3%)
Mutual labels:  egg, egg-plugin
egg-grpc
grpc plugin for egg
Stars: ✭ 79 (+243.48%)
Mutual labels:  egg, egg-plugin
egg-rbac
Role Based Access Control for eggjs
Stars: ✭ 32 (+39.13%)
Mutual labels:  egg, egg-plugin
Cool Admin Api
cool-admin-api 是基于egg.js、typeorm、jwt等封装的api开发脚手架、快速开发api接口
Stars: ✭ 188 (+717.39%)
Mutual labels:  egg, egg-plugin
egg-aop
AOP plugin for eggjs, add DI, AOP support.
Stars: ✭ 44 (+91.3%)
Mutual labels:  egg, egg-plugin
Egg Oauth2 Server
🌟 OAuth2 server plugin for egg.js based on node-oauth2-server
Stars: ✭ 174 (+656.52%)
Mutual labels:  egg, egg-plugin
Egg Validate
validate plugin for egg
Stars: ✭ 224 (+873.91%)
Mutual labels:  egg, egg-plugin
Egg Multipart
multipart plugin for egg
Stars: ✭ 145 (+530.43%)
Mutual labels:  egg, egg-plugin
bulk-mail-cli
Do quick, hassle-free email marketing with this small but very powerful tool! 🔥
Stars: ✭ 88 (+282.61%)
Mutual labels:  mailer, nodemailer
Egg Passport
passport plugin for egg
Stars: ✭ 98 (+326.09%)
Mutual labels:  egg, egg-plugin
Egg Router Plus
The missing router feature for eggjs
Stars: ✭ 117 (+408.7%)
Mutual labels:  egg, egg-plugin
egg-exporter
Egg.js 的 Prometheus 指标收集插件,附带 Grafana 看板。
Stars: ✭ 24 (+4.35%)
Mutual labels:  egg, egg-plugin
egg-sentry
Sentry Plugin For Egg.js
Stars: ✭ 18 (-21.74%)
Mutual labels:  egg, egg-plugin

egg-mailer

nodemailer plugin for Egg.js.

NPM version build status Test coverage David deps Known Vulnerabilities npm download

README | 中文文档

Install

$ npm i egg-mailer --save

Usage

// {app_root}/config/plugin.js
exports.mailer = {
  enable: true,
  package: 'egg-mailer',
};

Configuration

// {app_root}/config/config.default.js
exports.mailer = {
  host: "smtp.ethereal.email",
  port: 587,
  secure: false, // true for 465, false for other ports
  auth: {
    user: testAccount.user, // generated ethereal user
    pass: testAccount.pass  // generated ethereal password
  }
};

see nodemailer for more detail.

Example

// app/controller/home.js
class HomeController extends Controller {
  async index() {
    const { ctx, app } = this;
    // sync
    await app.mailer.send({
      from: '"Fred Foo 👻" <[email protected]>', // sender address, [options] default to user
      // // Array => ['[email protected]', '[email protected]']
      to: "[email protected], [email protected]", // list of receivers
      subject: "Hello ✔", // Subject line
      text: "Hello world?", // plain text body
      html: "<b>Hello world?</b>" // html body
    });
    // async
    app.mailer.send({
      from: '"Fred Foo 👻" <[email protected]>',
      // Array => ['[email protected]', '[email protected]']
      to: "[email protected], [email protected]",
      subject: "Hello ✔",
      text: "Hello world?",
      html: "<b>Hello world?</b>"
    }, function (err, info) {
      if (err) {
        throw err;
      }
      console.log(info);
    });
    ctx.body = 'hi, mailer';
  }
}

Questions & Suggestions

Please open an issue here.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].