Page 1 of 1

User registration process - Server Code

Posted: Mon Jul 29, 2013 4:33 pm
by Dupdroid

Is it possible to send an email after inserting a row into a collection using Server Code?

I'd like to use this as part of a user registration process. The idea is for a new user to register and then for the server to send an email containing a link to activate the account.

Or is there a better way to achieve this kind of functionality?


User registration process - Server Code

Posted: Mon Jul 29, 2013 8:53 pm
by Kateryna Grynko

Hi Christo,

Server code cannot send a letter. Please take a look here to implement what you need: http://docs.appery.io/?s=sendgrid


User registration process - Server Code

Posted: Mon Jul 29, 2013 9:42 pm
by Dupdroid

Thank you Katya,

I will give it a try.


User registration process - Server Code

Posted: Thu Oct 01, 2015 4:46 pm
by Matt6607699

Is it possible to send an email with Sendgrid but have it originate from Server Code?
For example:
code
var address = encodeURI("https://api.sendgrid.com/api/mail.send.json?api_user=XXXX&api_key=XXXXX&to=me@example.com&from=admin@example.com&subject=New Connection&text=You have a new connection");
try{
var XHRResponse = XHR.send("GET",address,{
success: function(data){
console.log(data)
},
error:function(e){
console.log(e);
}
});
}catch(e){

Code: Select all

 } 

/code
I tried this but it doesn't send an email, it does console log { message: 'success' } though. Do you know of any better way to do this? I use your backend for my website so I can't use the app builder method.


User registration process - Server Code

Posted: Thu Oct 01, 2015 6:10 pm
by Matt6607699

Update:

The above code actually works, for some reason it was just not sending it to my test hotmail account. I tried sending to a gmail account and it worked fine. So if anyone needs to send an email from server code, use Sendgrid and the above method.