Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodemailer

const nodemailer = require("nodemailer");

let email = ""
let send_to = ""

// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: "", // generated ethereal user
pass: "", // generated ethereal password
},
});


var mailOptions = {
from: email,
to: send_to,
subject: 'Sending Email using Node.js',
text: '<h1>TEST DESH!!</h1>'
};

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

nodemailer

npm install nodemailer
Comment

how to use nodemailer

const transporter = nodemailer.createTransport({
    host: 'smtp.ethereal.email',
    port: 587,
    auth: {
        user: 'merritt92@ethereal.email',
        pass: 'ZpKpEXzF1P1VFV7HPX'
    }
});
Comment

how to use nodemailer

const transporter = nodeMailer.createTransport({
    host: process.env.SMTP_HOST,
    port: 587,
    secure: false,
    auth: {
      user: process.env.SMTP_MAIL,
      pass: process.env.SMTP_PASSWORD,
    },
  });

  const mailOptions = {
    from: process.env.SMTP_MAIL,
    to: emailUser.email,
    subject: emailUser.subject,
    text: emailUser.message,
  };

  await transporter.sendMail(mailOptions);
Comment

nodemailer

yarn add nodemailer
Comment

nodemailer

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

var transport = nodemailer.createTransport(smtpTransport({
    service: 'gmail',
    auth: {
        user: 'myemail@gmail.com', // my mail
        pass: 'mypassword'
    }
}));
Comment

PREVIOUS NEXT
Code Example
Javascript :: tutorial of machine learning js 
Javascript :: nested function 
Javascript :: vue3 header 
Javascript :: string immutable javascript 
Javascript :: divide symbol to string in javascript 
Javascript :: target data option select vue js 
Javascript :: nodejs: router by use express and path package 
Javascript :: js get elements in array from x to y 
Javascript :: jquery traversing methods 
Javascript :: javascript arguments 
Javascript :: arcgis for javascript 
Javascript :: node js crud operation 
Javascript :: window parent frames js 
Javascript :: how to push array object name javascript 
Javascript :: boolean as string javascript 
Javascript :: class 
Javascript :: arrow functions syntax 
Javascript :: react createelement 
Javascript :: mdn trimstart 
Javascript :: scroll to div bottom 
Javascript :: base64 to base64url javascript 
Javascript :: how to make chrome extension js 
Javascript :: javascript easy resize for screen size 
Javascript :: delete item from array of objects javascript 
Javascript :: how to find out what a string ends with in javascript 
Javascript :: const in javascript 
Javascript :: react native stepper 
Javascript :: sort array 
Javascript :: mutation observer 
Javascript :: Javascript "For..in Loop" Syntax 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =