Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

User registration process - Server Code

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

User registration process - Server Code

Hi Christo,

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

Dupdroid
Posts: 0
Joined: Sat Mar 30, 2013 9:07 pm

User registration process - Server Code

Thank you Katya,

I will give it a try.

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

User registration process - Server Code

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.

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

User registration process - Server Code

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.

Return to “Issues”