ezMailer v0.0.1
Out of the box Email wrapper for popular nodejs email systems ( NodeMailer, Sendgrid, MailGun)
Do you go through the hassel of changing code just to change the emailing system for your node app? Worry no more ...
ezMailer is a one-stop solution for your node emailing system. Nodemailer, Sendgrid and Mailgun is already integrated and so you just basically use senMail function everywhere. If you need to change the underlying emailing system, just change it in the app, on the fly ( no need to restart your node app).
Oh, and it has full blown templating support as well! Yay!
Psst, it works out of the box. Go, rock your node app.
Requirements
- node >= 6
- npm >= 3
Installation
npm install @abhishekdeb/ezmailer --save
Usage example
ezMailer needs a config file which will contain your smtp credentials for NodeMailer, sendgrid, etc...
Have a look at example directory.
- Create a Config File:
"use strict";
var config=exports=module.exports={};
config.mailService={
templatePath:'./',
mailer:{ //Node-mailer
service:'Gmail', //yahoo, etc.
user:'[Username]@gmail.com',
pass:'[Your_Password]'
},
sendgrid: '[Your_SendGrid_Key]',
mailgun:{
apiKey:'[Your_Mailgun_key]',
domain:'[Your_website_domain]'
}
};
- Require this config and pass it to ezmailer with default system
const config=require('./sample-config');
let ezmailer=require('ezmailer')(config.mailService,'mailer'); //mailer / sendgrid / mailgun
- Load up email options and sendMail
let mailOptions={
from:'from@gmail.com',
to:'to@gmail.com',
subject:'Sample Basic ezmailer test',
body:{
text:'This is basic ezmailer test. ',
html:'<h1>This is <u>Basic</u> <i>ezmailer</i> test.'
}
};
//Send the mail. sendMail returns a promise.
ezmailer.sendMail(mailOptions).then(data=>{
console.log('Email has been sent : ',data);
},err=>{
console.log('Email could not be sent : ',err);
});
For more examples and usage, please refer to the (Wiki)wiki.
Features
- Simple and ready to use, yet Powerful Email API
- Nodemail, email-templates, sendgrid, Mailgun integrated
- Examples incuded
- Config style setup
- Promisified API
- Used in generator-restgoose
- Much more to come ...
Release History
- 0.0.1
- Initial Release
- Templating System Integrated
Meta
Abhishek Deb – @vikz91 – vikz91.deb@gmail.com
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/vikz91
Contributors
- VikZ91 - Base System
- EranGoldman - Adding Mailgun
Contributing
- Fork it (https://github.com/yourname/yourproject/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
Bucet List
Seperate Config File SystemUpdate ReadMeSeperate Npm Package (from generator-restgoose)- Extensive Testing
- Write Test Cases using Karma
- Write Functions to add custom email transport
- Add to Travis / Circle
- Adding Attachments
- Subject Template
- Adding Support for MailChimp