architect-mailer

1.1.1 • Public • Published

architect-mailer NPM version

expose mailer service as architect plugin.

Installation

npm install --save architect-mailer

Config Format

{
  packagePath: 'architect-mailer',
  transport: {
    tls: {
        rejectUnauthorized: false,
    },
    ignoreTLS: true,
    secure: false,
    port: 25,
  },
  mail: {
    config1: {
        from : 'noreply@example.com',
    }
  }
}

Usage

Boot Architect :

var path = require('path');
var architect = require("architect");

var configPath = path.join(__dirname, "config.js");
var config = architect.loadConfig(configPath);

architect.createApp(config, function (err, app) {
    if (err) {
        throw err;
    }
    console.log("app ready");
});

And use the service in your app :

module.exports = function setup(options, imports, register) {
    var mailer = imports.mailer;

    // send mail
    mailer.config1.sendMail({
        to: 'someone@example.com',
        subject: 'this the mail subject',
        html: '<p>html message</p>'
    }).then(() => {
        console.log('mail sent !');
    });
    
    register();
};
// Consume rest plugin
module.exports.consumes=['mailer'];

Options

Readme

Keywords

Package Sidebar

Install

npm i architect-mailer

Weekly Downloads

24

Version

1.1.1

License

ISC

Unpacked Size

15.7 kB

Total Files

5

Last publish

Collaborators

  • jcreigno