skiff-dispatcher-smtp
v1.0.1
Published
Provides 2 pluggable RPC calls: one generates smtp pool, and the other is responsible for generating smtp access credentials cache
Downloads
4
Maintainers
Readme
Skiff dispatcher SMTP
Plugin for skiff-dispatcher, adds methods for handling distributed email messaging
Install
npm install skiff-dispatcher skiff-dispatcher-smtp -S
Usage
var Dispatcher = require('skiff-dispatcher');
var DispatcherSMTP = require('skiff-dispatcher-smtp');
DispatcherSMTP.init({
gmail: {
clientId: '<your client id>',
clientSecret: '<your client secret>',
accessUrl: '<optional>'
},
yahoo: {
// ...
}
});
// create dispatcher cluster
var dispatcher = new Dispatcher(...);
// defined this on the dispatcher object, since it can not be called remotely
dispatcher.function_to_preprocess_emails = function (username, email, next) {
// do async preprocessing here
// next(err, processedEmail)
};
// call the method
dispatcher.sendMail('[email protected]', {
credentials: {
// ...
},
email {
// nodemailer email options
},
prepareEmailFunctionName: 'function_to_preprocess_emails'
}, function (err, info) {
// ...
});