Thursday 15 August 2013

javascript - Parse Cloud Code Mandrill Promise -


I have a problem that is migrating away from Malgun and starting using the Mandril. I have followed the parse purchase application tutorial and have very similar code base. Here it is that is present and runs successfully.

  Return to Mailgun.AndEmail ({From: Current User.et ('Email'), From: Host Email, Subject: 'Your ticket (C) for purchase' eventObject.get ('Title') + 'was successful!', Text: body}). Then (empty, function (error) {return Parse.Promise.error ('Your purchase was successful, but we were not able to send you an email.');});  

So it runs successfully, no error is thrown.

Then there is a reason for Mandril's equivalent,

  Return to Mandrill.sendEmail ({Message: {Text: Body, subject: 'For Your Ticket (Transfer)' EventObject.get ('title') + 'was successful!', From_mail: host e-mail, from_name: APIN: from: [{Email: current user ('email'), name: currentUser.get ('displayName') }], Async: true}). Then (empty, function (error) {console failed to send email. Error: '+ error); return parse. Promotion (' your purchase was successful, but we were not able to send you an email. ');});  

Apparently, it is not working.

Error log shows:

  error: type error: properties 'success' organic.exportsAnd main (undetermined) on undetermined (mandiril.js: 55:21). JS: 115: 25 A (pars.js: 2: 6670) pars. In JS: 2: 611 9 in Array. Each (original) Object.x.each.x.forEach [as_arrayEach] (Parse.js: 1: 661) at c.extend.resolve (Parse.js: 2: 6070) at Parse.js: 2: 674 9E (Parse.js: 2: 6670) at Parse.js: 2: 611 9 (Code: 141, Version 1.6.0)  

So I think Mandil successfully sends an email Because its search is 'success' property, but the promise has always been unsuccessful and gives an error response back to the iOS app.

Any help would be appreciated!

Thank you again

Problem found that you actually declared a wired variable And have to send success / failure callback to it.

The post I have posted in this comment helps me

Whatever I have done now,

  pars.cloud.Diffin ('Purchase', function (request, response) {... ... ... var message = {text: body, subject: 'eventObject.get (' title ') for your ticket (s) +' Was successful! ',' E-mail ': host e-mail, from_name: apmAM ,: [{email: currentUser.get (' email '), name: currentUser.get' DisplayName '),}]} Send back mandal email mail ( message). Then (void, function (error) {console.log (sending email is failing error. 'Error:' error); return paras. Publicity panic ('your purchase was successful, but we are not able to send you an email '); ... ... ...}); Var sendMandrillEmailPromise = function (message) {new parse from var promi Publicity (); Mandrill.sendEmail ({Message: message, async: true,}, {success: function (httpResponse) {promise.resolve (httpResponse);}, error: function (error) {promise.error (error);}}); Return promise; }  

Works as expected and I've got a terrific email! Thanks guys for your input!


No comments:

Post a Comment