Skip to content

Instantly share code, notes, and snippets.

@ivanstoyanov
Created December 11, 2012 04:49
Show Gist options
  • Select an option

  • Save ivanstoyanov/4255946 to your computer and use it in GitHub Desktop.

Select an option

Save ivanstoyanov/4255946 to your computer and use it in GitHub Desktop.
BL example
function onPostSave(request, response, modules) {
var to, logger = modules.logger, email = modules.email, body = request.body;
for (var i = 0; i < body.invitees.length; i++){
/* assumes the following request JSON body
{
"invitees": ["invitee1@gmail.com", "invitee2@gmail.com"],
"subject": "New invitation",
"body": "You are invited to this awesome new event. Hope you can make it",
"reply_to": "support@company.com"
}*/
to = body.invitees[i];
logger.info("Sending e-mail to: " + to);
email.send('my-app-invitation@my-app.com', to, body.subject, body.body, body.reply_to);
}
response.continue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment