Last active
August 29, 2015 14:14
-
-
Save ardrian/dcb47afeb59cad0234eb to your computer and use it in GitHub Desktop.
Parse.com Mandrill Send with Promise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method sends an email via Mandrill. It returns a promise chain | |
// so that it can be more neatly included as part of a promise chain. | |
var sendMandrillEmailPromise = function(message,send_at){ | |
var promise = new Parse.Promise(); | |
Mandrill.sendEmail({ | |
message: message, | |
async: true, | |
send_at: send_at | |
},{ | |
success: function(httpResponse) { | |
promise.resolve(httpResponse); | |
}, | |
error: function(error) { | |
promise.error(error); | |
} | |
}); | |
return promise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment