Skip to content

Commit

Permalink
feat(mailer): Added basic mailer utility
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Nov 15, 2014
1 parent ff8c8d3 commit 9dd8802
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/utils/mailer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
var Promise = require( 'bluebird' )
, config = require( 'config' )
, sendgrid = require( 'sendgrid' )( config.sendgrid.apiUser, config.sendgrid.apiKey );
, sendgrid;

module.exports = {
module.exports = {
send: function( payload ) {
if ( !sendgrid ) {
sendgrid = require( 'sendgrid' )( config.sendgrid.apiUser, config.sendgrid.apiKey );
}

return new Promise( function( resolve, reject ) {
sendgrid.send( payload, function( err, res ) {
if ( !err ) {
Expand Down

0 comments on commit 9dd8802

Please sign in to comment.