授权失败emailjs heroku

时间:2018-01-28 22:38:17

标签: javascript node.js email heroku

使用emailjs在我的nodejs应用程序上发送电子邮件。 但是,它在heroku上部署时会显示以下错误,这很奇怪,因为应用程序在本地工作

2018-01-28T22:28:24.689274+00:00 app[web.1]: { Error: 
authorization.failed (timedout while connecting to smtp server)
2018-01-28T22:28:24.689286+00:00 app[web.1]:     at module.exports 
(/app/node_modules/emailjs/smtp/error.js:2:13)
2018-01-28T22:28:24.689290+00:00 app[web.1]:     at failed 
(/app/node_modules/emailjs/smtp/smtp.js:501:28)
2018-01-28T22:28:24.689292+00:00 app[web.1]:     at response         
(/app/node_modules/emailjs/smtp/smtp.js:506:13)
2018-01-28T22:28:24.689293+00:00 app[web.1]:     at caller 
(/app/node_modules/emailjs/smtp/smtp.js:48:14)
2018-01-28T22:28:24.689295+00:00 app[web.1]:     at response 
(/app/node_modules/emailjs/smtp/smtp.js:198:9)
2018-01-28T22:28:24.689296+00:00 app[web.1]:     at caller 
(/app/node_modules/emailjs/smtp/smtp.js:48:14)
2018-01-28T22:28:24.689298+00:00 app[web.1]:     at TLSSocket.response 
(/app/node_modules/emailjs/smtp/smtp.js:178:11)
2018-01-28T22:28:24.689300+00:00 app[web.1]:     at Object.onceWrapper 
(events.js:315:30)
2018-01-28T22:28:24.689302+00:00 app[web.1]:     at emitOne 
(events.js:116:13)
2018-01-28T22:28:24.689304+00:00 app[web.1]:     at TLSSocket.emit 
(events.js:211:7)
2018-01-28T22:28:24.689307+00:00 app[web.1]:   code: 3,
2018-01-28T22:28:24.689308+00:00 app[web.1]:   previous: { Error: 
timedout while connecting to smtp server
2018-01-28T22:28:24.689310+00:00 app[web.1]:     at module.exports 
(/app/node_modules/emailjs/smtp/error.js:2:13)
2018-01-28T22:28:24.689312+00:00 app[web.1]:     at TLSSocket.timedout 
(/app/node_modules/emailjs/smtp/response.js:32:29)
2018-01-28T22:28:24.689313+00:00 app[web.1]:     at Object.onceWrapper 
(events.js:313:30)
2018-01-28T22:28:24.689314+00:00 app[web.1]:     at emitNone 
(events.js:106:13)
2018-01-28T22:28:24.689315+00:00 app[web.1]:     at TLSSocket.emit 
(events.js:208:7)
2018-01-28T22:28:24.689316+00:00 app[web.1]:     at 
TLSSocket.Socket._onTimeout (net.js:407:8)
2018-01-28T22:28:24.689318+00:00 app[web.1]:     at ontimeout 
(timers.js:475:11)
2018-01-28T22:28:24.689319+00:00 app[web.1]:     at tryOnTimeout 
(timers.js:310:5)
2018-01-28T22:28:24.689320+00:00 app[web.1]:     at Timer.listOnTimeout 
(timers.js:270:5) code: 4, smtp: undefined },
2018-01-28T22:28:24.689322+00:00 app[web.1]:   smtp: undefined }

我的stmp身份验证代码

var server = email.server.connect({
  user: email,
  password: pass,
  host: "smtp-mail.outlook.com",
  tls: { ciphers: "SSLv3" }
});

我已经尝试了

var https = require('https');
https.globalAgent.options.secureProtocol = 'SSLv3_method';

现在有类似问题的帖子,但是,在这种情况下,我使用的是Outlook而不是其他服务

0 个答案:

没有答案