Send mail with nodejs

For a school project I have to build a website and all the stuff... I want to send an email when a certain button is pressed. For now I used an gmail address for the server BUT it needs authentification and all. How can I bypass the authentification ? Are there some other STMP servers that do not require authentification so I send an email easily ?

Thanks guys !

1 answer

  • answered 2019-05-17 09:23 Narendra Chouhan

    You should use Nodemailer

    Its a npm module installed it and there you go.

    var nodemailer = require('nodemailer');
    var transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: {
        user: '',
        pass: 'yourpassword'
    var mailOptions = {
      from: '',
      to: '',
      subject: 'Sending Email using Node.js',
      text: 'That was easy!'
    transporter.sendMail(mailOptions, function(error, info){
      if (error) {
      } else {
        console.log('Email sent: ' + info.response);

    Refer :