Skip to content

bimedia-fr/architect-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published