sendgrid-mustacher
v1.0.2
Published
Send lot emails using Sendgrid and template that using Mustache ;D
Downloads
10
Maintainers
Readme
sendgrid-mustacher
Send lot emails using Sendgrid and template that using Mustache ;D
Get Started
npm install --save sendgrid-mustacher
This project help you to send Emails using the powerfull Sendgrid API and template that using the awesome Mustache!
var SendgridMustacher = require('sendgrid-mustacher');
var sendgridMustacher = new SendgridMustacher(API_USER, API_PASSWORD, opts); // You can just use your API_KEY instead API_USER and API_PASSWORD;
sendgridMustacher.sendBBatch({
from: '[email protected]',
subject: 'Awesome email subject',
text: 'Hello, {{name}}',
html: '<html><body>Hello, {{name}}</body></html>'
}, [{
email: '[email protected]',
name: 'Marcos'
}, {
email: '[email protected]',
name: 'Benjamin'
}], function(err, response){
if(err){
throw err;
}
console.log(response); // [{ email: '[email protected]', message: 'success'}, { email: '[email protected]', message: 'success'}];
});
SendgridMustacher([api_key || api_user], [api_password || options])
You can instantiate the SendgridMustacher passing the API_USER and API_PASSWORD or just send your API_KEY. All options are available!
sendBatch(sharedData, contentData [callback]) -> Promise
On the example above you can see all the information passed for the sendBatch
the email is associated in a set of data, because the custom data are direct for the email.
You can using too a callback or a Promise for resolving this function.
License
Licensed under the MIT License.