Node.JS

Using NODE.JS with SocketLabs requires that you have Nodemailer installed.

You will need to make configuration changes to your Nodemailer config file, as shown below:

 
var nodemailer = require("nodemailer");

var smtpTransport = nodemailer.createTransport("SMTP",{
host: "smtp.socketlabs.com",
port: 2525, // 587 and 25 can also be used.
auth: {
user: "Your SocketLabs SMTP username",
pass: "Your SocketLabs SMTP password"
}
});

smtpTransport.sendMail({
from: ‘"Sender Name"sender@example.com’,
to: ‘"Recipient Name"recipient@example.com’,
subject: "Your Subject",
text: "It is a test message"
}, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
});