Created
March 29, 2013 23:24
-
-
Save typerandom/5274356 to your computer and use it in GitHub Desktop.
Send email with Node.js using AlphaMail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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