我只是試圖發送Meteor的驗證電子郵件,根據此文檔:https://github.com/Shekharrajak/meteor-email,它返回下面的錯誤。我逐字跟蹤了文檔。郵件未發送;啓用發送,設置MAIL_URL環境變量
我的代碼
import { Meteor } from 'meteor/meteor';
if (Meteor.isServer){
Meteor.startup(() => {
process.env.MAIL_URL="smtp://mygmailaddress%40gmail.com:[email protected]:465/";
});
Email.send({
to: "[email protected]",
from: "[email protected]",
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: [email protected]
I20170420-14:49:35.023(1)? To: [email protected]
I20170420-14:49:35.026(1)? Subject: Example Email
I20170420-14:49:35.027(1)? Message-ID: <[email protected]>
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。 – bergjs
如果您在此處使用'Meteor.isServer',則表示您的祕密正在發送給客戶端。這個文件應該在'server /'目錄下。 – Brendon