首页 文章

为什么我的带有帐户包的Meteor应用程序没有发送验证邮件?

提问于
浏览
12

我正在制作一个流星应用程序,我添加了mrt accounts-password包以及mrt accounts-ui-bootstrap-dropdown .

我添加了登录按钮,以便用户可以创建一个帐户,并且工作得很好 . 我正在使用所有默认值 .

在服务器上我有代码:

Accounts.config({
  sendVerificationEmail: true,
  forbidClientAccountCreation: false
});

当我创建一个新帐户时,服务器控制台会打印:

I20130821-18:31:42.105(-4)? ====== BEGIN MAIL #0 ======
I20130821-18:31:42.106(-4)? MIME-Version: 1.0
I20130821-18:31:42.107(-4)? From: "Meteor Accounts" <no-reply@meteor.com>
I20130821-18:31:42.108(-4)? To: hidden@hidden.edu
I20130821-18:31:42.108(-4)? Subject: How to verify email address on localhost:3000
I20130821-18:31:42.109(-4)? Content-Type: text/plain; charset=utf-8
I20130821-18:31:42.109(-4)? Content-Transfer-Encoding: quoted-printable
I20130821-18:31:42.109(-4)? Hello,
I20130821-18:31:42.110(-4)? To verify your account email, simply click the link below.
I20130821-18:31:42.110(-4)? http://localhost:3000/#/verify-email/C2vJeaDLeMkkWmcRY
I20130821-18:31:42.111(-4)? Thanks.
I20130821-18:31:42.111(-4)? ====== END MAIL #0 ======

所以看起来它从服务器发送电子邮件但我从未在收件箱中收到验证邮件 . 我尝试了多次,已经超过一个小时了!我还查看了垃圾邮件文件夹 . 是什么赋予了?

提前致谢

2 回答

  • 14

    看这里:http://docs.meteor.com/#email

    如果未设置MAIL_URL(例如,在本地运行应用程序时),则Email.send将消息输出到标准输出

    像Meteor这样的Web服务器不能自己发送电子邮件,他们需要一台SMTP服务器才能这样做 . 您需要设置一个并使用 MAIL_URL 变量进行设置 .

  • 18

    要配置 MAIL_URL ,请不要忘记添加核心电子邮件包:

    meteor add email
    

    然后,服务器端:

    // server/smtp.js
    Meteor.startup(function () {
      smtp = {
        username: 'your_username',   // eg: server@gentlenode.com
        password: 'your_password',   // eg: 3eeP1gtizk5eziohfervU
        server:   'smtp.gmail.com',  // eg: mail.gandi.net
        port: 25
      }
    
      process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '@' + encodeURIComponent(smtp.server) + ':' + smtp.port;
    });
    

    Read MoreVerify an Email with Meteor Accounts .

相关问题