New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nicemail

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nicemail

An easy to use nodejs mailing library with integration for different templates

latest
npmnpm
Version
1.0.4
Version published
Weekly downloads
6
20%
Maintainers
1
Weekly downloads
 
Created
Source

#NodeMailer

###An easy to use nodejs mailing library with integration for different templates

npm install --save nicemail

Requirements

  • Node.js >= 6.11.0
  • ECMAScript >= 6

Usage

const Nicemail = require('nicemail');
const path = require('path');

const emailConfig = {
    sender: 'Sender <abc@company.com>',   // sender email
    host: 'smtp.gmail.com',
    port: '465',
    auth: {
        user: '',
        pass: ''
    }
};

const templateConfig = {
    dir: path.join(__dirname,'./template') ,
    type: 'hbs'         //  template type (also supports ejs and jade templates)
}

const nm = new Nicemail(emailConfig, templateConfig);
const receipents = ['abc@gmail.com','bcd@gmail.com'];

nm
  .send({
    template: 'simple',             // template name
    subject: 'Simple subject text', // email subject
    content: {                      // template locals
        title : 'This is title',
        header : 'This is header',
        body : 'Body Message'
    },
    to : receipents.join(',')    // comma seperated email recipients
  })
  .then(res => console.log('Response: ', res))
  .catch(err => console.log('Errors: ', err));

templates/simple.hbs:

<div>
 {{ title }}
 <h6>{{ header }}</h6>
 <p>{{ body }}</p>
</div>

####Other templates

templates/simple.pug:

.div
	#{ title }
	h6 #{ header }
	p #{ body } 

templates/simple.ejs:

<div>
 <%= title %>
 <h6><%= header %></h6>
 <p><%= body %></p>
</div>

Keywords

mail

FAQs

Package last updated on 23 Jul 2017

Did you know?

Socket

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.

Install

Related posts