Skip to content

Instantly share code, notes, and snippets.

@ivanstoyanov
Created December 11, 2012 21:59
Show Gist options
  • Save ivanstoyanov/4262638 to your computer and use it in GitHub Desktop.
Save ivanstoyanov/4262638 to your computer and use it in GitHub Desktop.
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", "[email protected]"],
"subject": "New invitation",
"body": "You are invited to this awesome new event. Hope you can make it",
"reply_to": "[email protected]"
}*/
to = body.to[i];
logger.info("Sending e-mail to: " + to);
email.send('[email protected]', 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