Sign In Register

How can we help you today?

Start a new topic
Answered

Can gamesparks send email?

I want to add email verification process.

Once a user register a new account using email address, send email with some URL and code. It is possible somehow?
Thanks in advance.


Best Answer

Hi,


Yes, you can send emails using the Send Grid integration. We have a tutorial of this that works with a password recovery scenario.


Send Grid API - https://docs.gamesparks.com/api-documentation/cloud-code-api/integrations/sendgrid.html

Password Recovery Example - https://docs.gamesparks.com/tutorials/social-authentication-and-player-profile/automating-user-password-change.html


Cheers,

Omar


Answer

Hi,


Yes, you can send emails using the Send Grid integration. We have a tutorial of this that works with a password recovery scenario.


Send Grid API - https://docs.gamesparks.com/api-documentation/cloud-code-api/integrations/sendgrid.html

Password Recovery Example - https://docs.gamesparks.com/tutorials/social-authentication-and-player-profile/automating-user-password-change.html


Cheers,

Omar

I want to user the gmail to send emails, its possible?

Hi Romulo,


We do not have an integration for Gmail however you can utilize any exposed web Api trough cloud code using Spark.Http. 


In this way you could configure events that interact with the Api in question. This may provide a solution for you, it's worth consulting googles Api's to see what level of control they allow, if any. 


Best Regards, Patrick. 

here's how to do it with mailgun

  

var params = {
    "to":"ccccc@xx.com", 
    "from":"ddddd@yy.com",
    "fromname":"Christian",
    "subject":"Send email example",
    "html":"the html body"
};

sendMailgunEmail(params);

function sendMailgunEmail (form)
{
    var httpSender = Spark.getHttp("https://api.mailgun.net/v3/xx.xxx.com/messages");
    httpSender.setBasicAuth("api","key-xxxxxxxxxxxxxxxx");
    var response = httpSender.postForm(form);
    var responseCode = response.getResponseCode();
    if (responseCode !== 200){
        var errMsg = "Send Email fail, error code: " + responseCode + " : " + response.getResponseString();
        Spark.getLog().error(errMsg);
        return false;
    }
    return true;
}

  


4 people like this

How do I load the html for an email?

I see the setHtml function for Spark.sendGrid but the html document I wish to send it kind of big for a single string. What is the correct way to import a custom email template?

Login to post a comment