Last active
August 29, 2015 14:16
-
-
Save aj07mm/036acc6da39f432774bf to your computer and use it in GitHub Desktop.
how to test response in a callback inside a method inside a method?
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
'sendMail': function(mailBody,maiSubject,mailTo, sendAt){ | |
if(mailTo == 'string'){ | |
mailTo = formatMailTo(mailTo); | |
} | |
var message = { | |
"html": mailBody, | |
"text": mailBody, | |
"subject": maiSubject, | |
"from_email": "[email protected]", | |
"from_name": "foobarsatanico", | |
"to": mailTo | |
}; | |
Mandrill.messages.send({"message": message, "async": false, "send_at": sendAt }, function(result) { | |
console.log(result); | |
return result; | |
}, function(e) { | |
console.log('A mandrill error occurred: ' + e.name + ' - ' + e.message); | |
return e.message; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inject a callback an return result.
sendMail: function(mailBody,maiSubject,mailTo, sendAt, callback) {
OR use Promise. 😃