Using nodemailer with Gmail

Hi, folks. I’m putting a contact form on my developer profile that sends me an email on submission. Gmail doesn’t 100% play well with nodemailer, and I’m running into a problem where all the emails I’m receiving look like they’re coming from myself. According to the nodemailer docs:
“Gmail also always sets authenticated username as the From: email address. So if you authenticate as foo@example.com and set bar@example.com as the from: address, then Gmail reverts this and replaces the sender with the authenticated user.”
Unfortunately, I have no idea what this “authenticated username” business means. The long and short of it, I’m wondering if there’s anything I can do to actually get the “from” field submitted correctly, short of making a new email account through someone other than Gmail. The nodemailer chunk of code is as follows:

var transporter = nodemailer.createTransport({
  service: "gmail",
  auth: {
    user: process.env.EMAIL,
    pass: process.env.PASSWORD
  }
});

app.post("/email", (req, res) => {
  var mailOptions = {
    from: `${req.body.name} <${req.body.email}>`,
    to: process.env.EMAIL,
    subject: req.body.subject,
    text: req.body.text
  };

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

Thanks in advance for any input!

Gmail does not let you use any other email address other than the authenticated one (your gmail account email address) for the from.

If I assume process.env.EMAIL is your email address, then does it really matter what the from email address is as long as you know what the value of req.body.email is? Why not add an extra line for the text field where you put the email address (req.body.email). This way, you get the information you need.

Thanks very much, that clears things right up!