【发布时间】:2017-04-20 13:56:39
【问题描述】:
我只是想在 Meteor 中发送验证电子邮件,基于此文档:https://github.com/Shekharrajak/meteor-email,它返回以下错误。我一字不差地跟着文档。
我的代码
import { Meteor } from 'meteor/meteor';
if (Meteor.isServer){
Meteor.startup(() => {
process.env.MAIL_URL="smtp://mygmailaddress%40gmail.com:mypassword@smtp.gmail.com:465/";
});
Email.send({
to: "sendeto@yahoo.com",
from: "sendfrom@gmail.com",
subject: "Example Email",
text: "The contents of our email in plain text.",
});
}
错误信息:
W20170420-14:49:33.820(1)? (STDERR) js-bson: Failed to load c++ bson extension, using pure JS version
I20170420-14:49:34.997(1)? ====== BEGIN MAIL #0 ======
I20170420-14:49:34.998(1)? (Mail not sent; to enable sending, set the MAIL_URL environment variable.)
I20170420-14:49:35.019(1)? Content-Type: text/plain
I20170420-14:49:35.021(1)? From: kehindeadeoya@gmail.com
I20170420-14:49:35.023(1)? To: ken4ward@yahoo.com
I20170420-14:49:35.026(1)? Subject: Example Email
I20170420-14:49:35.027(1)? Message-ID: <6b59f210-f727-aff3-2695-335a774e936a@gmail.com>
I20170420-14:49:35.028(1)? Content-Transfer-Encoding: 7bit
I20170420-14:49:35.031(1)? Date: Thu, 20 Apr 2017 13:49:35 +0000
I20170420-14:49:35.032(1)? MIME-Version: 1.0
I20170420-14:49:35.034(1)?
I20170420-14:49:35.050(1)? The contents of our email in plain text.
I20170420-14:49:35.052(1)? ====== END MAIL #0 ======
我该怎么做?请帮忙。
【问题讨论】:
-
您确定在尝试发送电子邮件之前设置了进程环境变量吗?尝试将
Email.send放在启动块中。 -
如果您在此处使用
Meteor.isServer,则表明您的机密正在发送给客户端。此文件应位于server/目录中。
标签: meteor smtp gmail meteor-blaze email-verification