Skip to content

Commit

Permalink
feat(mailer): Simple send grid mailer added
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Nov 15, 2014
1 parent ea11e4a commit bc65aec
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/utils/mailer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var Promise = require( 'bluebird' )
, config = require( 'config' )
, sendgrid = require( 'sendgrid' )( config.sendgrid.apiUser, config.sendgrid.apiKey );

module.exports = {
send: function( payload ) {
return new Promise( function( resolve, reject ) {
sendgrid.send( payload, function( err, res ) {
if ( !err ) {
resolve( res );
} else {
reject( new Error( err ) );
}
});
});
}
}

0 comments on commit bc65aec

Please sign in to comment.