Posts

Showing posts from August, 2015

sending an email in nodejs

/****To send a mail  ** steps to follow 1. get email server details 2. create a smtp transport connection 3. send a mail via connection 4. close connection **/ var fs = require('fs'); var nodemailer = require('nodemailer'); //Mail server details var host = ''; var port = ''; var ssl = false; var userName = ''; var password = ''; //Generic email transport connection var getMailTransportCon = function() {     var smtpoptions = {         host: host,         port: port,         secureConnection: ssl,         auth: {             user: userName,             pass: password         }     };     //Create a mail transport connection     var mailTranspo...

Phantom js tutorial

Phantomjs is very useful tool for taking screenshot of the webpages. To take a screenshot of the simple page webpage. var phantom = require('phantom'); /***take screenshot of url**/ var options = {     path: "/phantom/bin/" }; phantom.create(function(ph) {     ph.createPage(function(page) {         page.open("http://www.google.com", function(status) {             console.log("opened page? ", status);             page.evaluate(function() {                 return document.title;             }, function(result) {                 console.log('Page title is ' + result);        ...