Start a new topic

Send email

Hi again! Is there a way to send email using the javascript SDK? or another way?


Hi Dan,


Emails related to account activation/ email verification/ password reset etc. can be configured through Kinvey console. These emails are sent out automatically when the specific conditions are triggered (e.g. app user requests password reset).


Apart from that, Business Logic offers in-built email module which you can use to send emails through BL code. The documentation is available as below:


The javascript SDK itself (or any other SDK for that matter) doesn't offer a way to send email. The best way to send email to app users would be by triggering custom BL endpoints.



Regards,

Wani

Kinvey Support

Thanks for your reply! So I have this endpoint script:


 

function onRequest(request, response, modules) {
  
  modules.logger.info("Estoy en el script.");
  var email = modules.email;
  var error, resultado;
  email.send( request.body.de,
              'my-email@gmail.com',
              'test',
              request.body.subject
            );
  response.complete(200);
  
	
}

And I'm trying to execute it with this code:


 

var promise = Kinvey.execute('enviar-email', {
        de: correo,
        subject: subjectfinal
    }, {
        success: function(response) {
            console.log("it works!");
        }
    });

 When I test the code in the console it works fine but when I'm executing it with my javascript it doesn't. Any tips?

 

How are you sure that this is not working for you Dan?  What error are you getting in the failure: callback in Javascript (if any)?

Thanks,

Sorry, it seems that I forgot to initiate Kinvey before that. Thanks!

 

Login or Signup to post a comment