Skip to content

Instantly share code, notes, and snippets.

@typerandom
Created March 29, 2013 23:24
Show Gist options
  • Save typerandom/5274356 to your computer and use it in GitHub Desktop.
Save typerandom/5274356 to your computer and use it in GitHub Desktop.
Send email with Node.js using AlphaMail
var alphamail = require('alphamail');
var emailService = new alphamail.EmailService("API-TOKEN");
var data = {name:"Joe", pwns:true, likesCats:"certainly"};
var payload = new alphamail.EmailMessagePayload()
.setProjectId(1235) // ID of your AlphaMail project
.setSender(new alphamail.EmailContact("My Company", "[email protected]"))
.setReceiver(new alphamail.EmailContact("Some dude", "[email protected]"))
.setBodyObject(data);
emailService.queue(payload, function(error, result){
if(error){
console.log(error);
return;
}
console.log("Email sent! ID = " + result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment