title: nodemailer not sending email on server?
body: <p>So i have created a form with a react front end and a node js and nodemailer backend. I am trying to send that data in an email. I can send it to the back end at that is received perfectly fine however, I am getting an issue when sending out the emaiil as the 'mail not sent' error is getting executed from the Transporter.sendMail function and I'm not to sure why.</p>
  
  <p>Would love to get some help. Please see the code below for my server. I have obviously removed my authentication details for security purposes.</p>
  
  <p>console log error: </p>
  
  <p>[0] not sent</p>
  
  <pre><code>const nodemailer = require('nodemailer');
  const path = require('path');
  const express = require("express");
  const app = express();
  const port = 5000;
  const cors = require("cors");
  app.use(cors());
  const bodyParser = require("body-parser");
  app.use(bodyParser.json()); // to support JSON-encoded bodies
  app.use(
    bodyParser.urlencoded({
      // to support URL-encoded bodies
      extended: true
    })
  );
  
  const transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
      user: 'email',
      pass: 'password',
  
    }
  });
  
  
  
  
  app.get("/home", (req, res) =&gt; {
      console.log("Hello from .get /home", req.body.generalDetails, req.body.firstName, req.body.mName );
  
  })
  
  
  
  
  
  
  app.post("/home", (req, res) =&gt; {
  
    var mailOptions = {
                  from: 'email',
                  to: 'email',
                  subject: 'Hello',
                  text: req.body.generalDetails,
  
              }
  
              transporter.sendMail(mailOptions, function(err, res) {
                  if (err) {
                      console.log('Mail not sent');
                  } else {
                      console.log('Mail sent');
                  }
              });
  
    let data = [{
      //page one data
      generalDetails: req.body.generalDetails,
      fName: req.body.fName,
      mName: req.body.mName,
      lName: req.body.lName,
      email: req.body.email,
  
     }];
  
     res.json(data);
   }
  
  );
  
  
  
  app.listen(port, () =&gt; `Server running on port ${port}`);
  </code></pre>