Error: connect ECONNREFUSED 127.0.0.1:578 or Error: getaddrinfo ENOTFOUND smpt.gmail.com

The error message "getaddrinfo ENOTFOUND smpt.gmail.com" indicates that the hostname "smpt.gmail.com" could not be resolved. There seems to be a typographical error in the hostname. It should be "smtp.gmail.com" instead of "smpt.gmail.com".

To resolve this issue, update the code with the correct hostname as follows:

const transporter = nodemailer.createTransport({
    port: 465,
    service: 'Gmail',
    secure: true,
    logger: true,
    debug: true,
    auth: {
        user: YOUR_MAIL_ADDRESS,
        pass: YOUR_APP_PASSWORD
    }

});

Make sure you have also installed the necessary dependencies, including the nodemailer module, for the code to work properly.