Sending email through nodemailer to forward email(forwardemail.net) connected to gmail

Tags: , , ,



I managed to send a message with nodemailer to my gmail address, but I can’t do it with my forward email. Here’s how it looks like for my gmail account

const transporter = nodemailer.createTransport({
  host: "smtp.gmail.com",
  port: 587,
  secure: false,
  auth: {
    user: mygmail@gmail.com,
    pass: myAppPassword
  }
});

What I want is to send mail with my forward email that is:

mymail@mydomain.com,

which is connected to gmail account and was added with

https://forwardemail.net/en

Answer

As long as you’ve been able to setup “Send email as” in Gmail using these instructions you’ll have the credentials you’ll need.

The user should just be the username of the gmail account without the @gmail.com. And the pass should be the one you generated at https://myaccount.google.com/apppasswords



Source: stackoverflow