Question

For my android app, I want to send a verification email to the user when they sign up. I'm want to do this through Mandrill with Parse backend. I copy and pasted the Mandrill Cloud Module from the Parse docs:

var mandrill = require("mandrill");
mandrill.initialize("mandrillAPIKey");

Parse.Cloud.define("myMandrillFunction", function(request, response) {
  mandrill.sendEmail({
    message: {
      text: "Hello World!",
      subject: "Using Cloud Code and Mandrill is great!",
      from_email: "parse@cloudcode.com",
      from_name: "Cloud Code",
      to: [
        {
          email: "you@parse.com",
          name: "Your Name"
        }
      ]
    },
    async: true
  }, {
    success: function(httpResponse) { response.success("Email sent!"); },
    error: function(httpResponse) { response.error("Uh oh, something went wrong"); }
  });
}

I replaced the mandrillAPIKEY and email fields with my own. But eclipse says that the "mandrill" string in require("mandrill"); is an invalid character constant. I think this might have to do with not importing Mandrill properly. How do I fix this?

Was it helpful?

Solution

I would suggest to change course. While the comment on your question is correct, parse has options to send a verification email when signing up using a parse user object. I would suggest to turn that on instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top