Meteor将电子邮件发送到Intranet电子邮件

时间:2017-05-11 13:55:30

标签: javascript node.js email meteor sendmail

我正在开发流程应用程序来处理请求,应用程序已完成,但我需要在每次创建或更新请求时发送一​​些带有默认文本的电子邮件。

我遇到的问题是,我在内联网上,而我们的邮件服务器正在使用标准的25端口。

我可以ping邮件服务器并检查:25端口是否打开。 localhost端口25处于侦听状态。

我正在使用meteor的默认电子邮件包,我在内部网之外使用了很多次,并且一直工作正常。

我的服务器代码如下:

#in the meteor startup i put the env MAIL_URL
process.env.MAIL_URL = 'smtp://varajao.rjr:password@ipaddress:25';
#in the methods i put the sendMail Func
sendEmail: function(to, from, subject, text) {
  console.log('para: '+ to + 'de: ' + from);
  console.log('assunto ' + subject + 'texto: ' + text);
  check([to, from, subject, text], [String]);
  this.unblock();

  Email.send({to, from, subject, text});

}

我在服务器上获得以下内容,检查第一行和最后的注释。

Exception while invoking method 'sendEmail' Error: getaddrinfo EAI_AGAIN varajao.rjr:587 **----->somehow this is my username with :587 port**
I20170511-13:50:57.171(1)?     at Object.Future.wait (/home/administrador/.meteor/packages/meteor-tool/.1.4.4_2.8rbyl1++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
I20170511-13:50:57.171(1)?     at Mail._syncSendMail (packages/meteor.js:213:24)
I20170511-13:50:57.172(1)?     at smtpSend (packages/email.js:110:13)
I20170511-13:50:57.172(1)?     at new Email.send (packages/email.js:168:5)
I20170511-13:50:57.173(1)?     at Object.Email.send (packages/meteortoys_email.js:28:25)
I20170511-13:50:57.174(1)?     at [object Object].Meteor.methods.sendEmail (server/main.js:375:13)
I20170511-13:50:57.175(1)?     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1737:12)
I20170511-13:50:57.175(1)?     at packages/ddp-server/livedata_server.js:719:19
I20170511-13:50:57.176(1)?     at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
I20170511-13:50:57.177(1)?     at packages/ddp-server/livedata_server.js:717:40
I20170511-13:50:57.178(1)?     - - - - -
I20170511-13:50:57.179(1)?   atObject.exports._errnoException(util.js:907:11)
I20170511-13:50:57.179(1)?     at errnoException (dns.js:32:15)
I20170511-13:50:57.180(1)?     at GetAddrInfoReqWrap.onlookup [as oncomplete](dns.js:78:26)

邮件服务器位于Intranet内部,我们可以通过内部网直接访问它。

你们能帮我一把吗?

谢谢是提前

罗布

1 个答案:

答案 0 :(得分:0)

请确保您的交换正确配置,因为如果不是,您将收到类似我在此问题中的错误,对我来说,我必须允许电子邮件中继到应用服务器的IP。 / p>

希望这有帮助

罗布