Meteor的新手。
我在用户按下按钮时发送电子邮件。按下按钮时出现这些错误:
I20170801-10:37:06.225(8)? Exception in defer callback: Error: Mail command failed: 503 5.5.2 Sender already specified [KL1PR03MB1416.apcprd03.prod.outlook.com]
I20170801-10:37:06.226(8)? at Object.Future.wait (/Users/duminda/.meteor/packages/meteor-tool/.1.4.3_2.1bvf0xf++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
I20170801-10:37:06.226(8)? at SMTPConnection._syncSend (packages/meteor.js:213:24)
I20170801-10:37:06.226(8)? at smtpSend (packages/email.js:112:8)
I20170801-10:37:06.227(8)? at Object.Email.send (packages/email.js:208:5)
I20170801-10:37:06.227(8)? at server/Travel/methods.js:5:19
I20170801-10:37:06.228(8)? at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
I20170801-10:37:06.228(8)? at packages/meteor.js:445:45
I20170801-10:37:06.229(8)? at runWithEnvironment (packages/meteor.js:1176:24)
I20170801-10:37:06.229(8)? - - - - -
I20170801-10:37:06.230(8)? at SMTPConnection._formatError (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:528:15)
I20170801-10:37:06.230(8)? at SMTPConnection._actionMAIL (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:1252:30)
I20170801-10:37:06.230(8)? at SMTPConnection.<anonymous> (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:759:14)
I20170801-10:37:06.231(8)? at SMTPConnection._processResponse (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:669:16)
I20170801-10:37:06.231(8)? at SMTPConnection._onData (/Users/duminda/.meteor/packages/email/.1.2.0.cuwbi8++os+web.browser+web.cordova/npm/node_modules/smtp-connection/lib/smtp-connection.js:493:10)
I20170801-10:37:06.231(8)? at emitOne (events.js:77:13)
I20170801-10:37:06.232(8)? at TLSSocket.emit (events.js:169:7)
I20170801-10:37:06.232(8)? at readableAddChunk (_stream_readable.js:153:18)
I20170801-10:37:06.232(8)? at TLSSocket.Readable.push (_stream_readable.js:111:10)
I20170801-10:37:06.233(8)? at TLSWrap.onread (net.js:537:20)
我的代码:
if(response === 1) {
sendDeferredEmail({
to: email,
from: "smtp@***.com",
subject: "New Travel Request pending response by " + user.username,
html: user.username + " added a new travel request." + "<br>"
});
...
function sendDeferredEmail(params)
{
try {
Meteor.defer(function () {
Email.send({to: params.to, from: params.from, subject: params.subject, html: params.html});
});
}
catch(e)
{
console.log("Caught exception when sending email:\n" + e);
}
}
电子邮件设置:
process.env.MAIL_URL = 'smtp://smtp@***:587';
这里出了什么问题,如何解决?
答案 0 :(得分:1)
我会评论但缺乏声誉......你按下按钮的速度有多快?大多数在线邮件服务器不允许中继发送以避免用户发送垃圾邮件。您是否尝试将其设置为服务器端功能并使用Meteor.call()
触发Email.send()
?