Znote (recipes)
  Get Znote  

Send mail with Gmail

How to send email with Node and mailmailer

 

Installation

Install npm dependencies npm i -S nodemailer

With Google, you need to generate a dedicated credential:

https://support.google.com/accounts/answer/185833

Send mail

const nodemailer = require('nodemailer');

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'YOURMAIL@gmail.com',
    pass: 'YOUR PASSWORD',
  },
});


transporter.sendMail({
  from: '"Anthony" <lagrede.anthony@gmail.com>', // sender address
  to: "anthony.lagrede@gmail.com", // list of receivers (,)
  subject: "Just to know if everything is fine 😊", // Subject line
  text: "Hi 👋, \nBeing very concerned about the quality of Znote app, I thank you for any feedback you could give me, allowing me to improve my software!", // plain text body
  html: "Hi 👋, <br/>Being very concerned about the <b>quality</b> of Znote app, I thank you for any feedback you could give me, allowing me to improve my software!", // html body
}).then(info => {
  printJSON({info});
});

Related recipes