nodemailer的邮件在azure服务器上不起作用 [英] mail for nodemailer didn't work on azure server

查看:72
本文介绍了nodemailer的邮件在azure服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用来自Microsoft Azure上的Express js服务器的nod​​emailer邮件api发送邮件.它在本地计算机上获得成功,但在azure服务器(远程)上却未获得成功.有什么主意吗?

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
      });

谢谢, av

推荐答案

以防万一其他人遇到相同的问题.

Just in case someone else meet the same problem.

我在Azure网站上运行Nodemailer时遇到了同样的问题.最后,我发现问题是我忘记将Nodemailer放在package.json中作为依赖项.然后,azure不知道必须为托管服务器安装Nodemailer.

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.

在package.json中的依赖项列表的末尾添加"nodemailer":"*".在添加"nodemailer"之前,请不要忘记在最后一行之后添加,".

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".

希望有帮助.

这篇关于nodemailer的邮件在azure服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆