流星邮件发送错误

时间:2015-06-15 09:24:09

标签: meteor

当我们在流星发送邮件时,它会给出错误。请帮助我。

process.env.MAIL_URL="smtp://abc@gmail.com:password@smtp.gmail.com:465/";

            // Send the e-mail
                Email.send({
                    to: "abc@gmail.com",
                    from: "sbc@gmail.com",
                    subject: "Website Contact Form - Message From ",
                    text: "Hello"
                });

这是我得到的错误。

 Exception while invoking method 'userRegistration' AuthError: Invalid login - 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsng
I20150615-14:31:12.494(5.5)?     at Object.Future.wait (/home/vamsi/.meteor/packages/meteor-tool/.1.1.3.1ullkdf++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
I20150615-14:31:12.495(5.5)?     at smtpSend (packages/email/email.js:76:1)
I20150615-14:31:12.495(5.5)?     at Object.Email.send (packages/email/email.js:153:1)
I20150615-14:31:12.495(5.5)?     at [object Object].userRegistration (app/server/registration.js:24:23)
I20150615-14:31:12.495(5.5)?     at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
I20150615-14:31:12.495(5.5)?     at packages/ddp/livedata_server.js:648:1
I20150615-14:31:12.495(5.5)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150615-14:31:12.495(5.5)?     at packages/ddp/livedata_server.js:647:1

1 个答案:

答案 0 :(得分:0)

您的MAIL_URL登录名和密码应使用encodeURIComponent进行URI编码:

var login = encodeURIComponent("abc@gmail.com");
var password = encodeURIComponent("password");
var domain = "smtp.gmail.com";
var port = 465;

process.env.MAIL_URL = "smtp://" + login + ":" + password + "@" + domain + ":" + port;

它会为您提供类似smtp://abc%40gmail.com:password@smtp.gmail.com:465的内容。