Skip to content

Instantly share code, notes, and snippets.

@typerandom
Created March 29, 2013 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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", "your@domain.com"))
.setReceiver(new alphamail.EmailContact("Some dude", "receiver@some55-domain.com"))
.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