Question

I am trying to send mail by using nodemailer's mail api from express js server on microsoft azure. It's getting success in local machine but not on azure server(remote). Any idea?

 var mail = require("nodemailer").mail;
 mail({from: "from@gmail.com", // sender address
       to: "to@gmail.com", // list of receivers
       subject: "subject", // Subject line
       text: "text", // plaintext body
       html: "<b>helloworld</b>" // html body
      });

thanks, av

Était-ce utile?

La solution

Just in case someone else meet the same problem.

I had the same problem about running Nodemailer in Azure Website. Finally I found the problem was that I forgot put Nodemailer as a dependency in package.json. Then azure did not know it had to install Nodemailer for the hosted server.

Add "nodemailer" : "*" at the end of dependency list in package.json. Don't forget to add a "," after the last line before you add "nodemailer".

Hope it helps.

Autres conseils

Please do changes in iisnode.yml file to call newer nodejs version as follows- nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\8.5.0\node.exe"

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top