Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodemailer gmail example

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');

var transporter = nodemailer.createTransport(smtpTransport({
  service: 'gmail',
  host: 'smtp.gmail.com',
  auth: {
    user: 'somerealemail@gmail.com',
    pass: 'realpasswordforaboveaccount'
  }
}));

var mailOptions = {
  from: 'somerealemail@gmail.com',
  to: 'friendsgmailacc@gmail.com',
  subject: 'Sending Email using Node.js[nodemailer]',
  text: 'That was easy!'
};

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('Email sent: ' + info.response);
  }
});

// There are more things to do according to the nodemailer documentation
// https://community.nodemailer.com/using-gmail/
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to detect safari browser in javascript 
Javascript :: how to get file name in directory node js 
Javascript :: react import font awesome 
Javascript :: cut array up javascript 
Javascript :: js form submit listener 
Javascript :: js get mouseclick 
Javascript :: javascript readfile 
Javascript :: jquery disable enter key submit 
Javascript :: get selected text of html dropdown in javascript 
Javascript :: unset radio button jquery by name 
Javascript :: javascript add required attribute to input 
Javascript :: ajax download file 
Javascript :: import json javascript 
Javascript :: how to generate a fibonacci sequence in javascript 
Javascript :: jstl replace 
Javascript :: unsafe value used in a resource URL context 
Javascript :: get current page title javascript 
Javascript :: javascript json foreach value 
Javascript :: npm font awesome vue 
Javascript :: find base url in javascript 
Javascript :: jquery select option auto select 
Javascript :: validate aadhaar number in javascript 
Javascript :: javascript convert number to hex 
Javascript :: add event listener to multiple element in JS 
Javascript :: regex expression dd/mm/yyyy javascript 
Javascript :: countTo add commas to number jquery 
Javascript :: reactjs checkbox 
Javascript :: javascript modal close 
Javascript :: javascript change long digit ot k,m 
Javascript :: display loader on ajax call 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =