Does Nodemailer SMTP work within azure functions?


Your error code shared shows that NodeMailers is unable to verify your identity.
  code: 'EAUTH',  command: 'API'
Issue found:
auth: {
      user: process.env.EMAIL,
      pass: process.env.PASSWORD,
    },

Authentication variables used are environment variable. This works when running locally because you must have an .env file with these variables hosted on your local server.


Solution:
You need to add all environment variables under as "New Application Settings" under "Application Settings" in "Configuration" (Settings Panel).

Doc reference - https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings?tabs=portal

enter image description here

Add the values as under :

Name - EMAIL , value - <youremail>
Name - PASSORD, value - <password>



This should fix the auth issue.