【问题标题】:How to send verification email using userAccounts,accounts-password in meteor如何使用流星中的用户帐户,帐户密码发送验证电子邮件
【发布时间】:2017-03-11 02:40:58
【问题描述】:

用户在我的应用中注册后,我正在尝试设置电子邮件验证,但我收到“内部服务器错误”

这是我创建注册表单的代码

 <template name="LoginModal">

    {{#if $not currentUser }}

        {{> atForm}}



   {{/if}}
  </template>
//code inside the client folder to configure email verification
   AccountsTemplates.configure({
   confirmPassword:false,
   termsUrl:'terms-of-use',
   privacyUrl:'privacy',
   sendVerificationEmail: true,
   enforceEmailVerification:true,

  forbidClientAccountCreation: true

  });

//Here is my route to load the signup form
 Router.route('/admin/addUser',{

     action: function () {
    BlazeLayout.render('master_layout',       
     {body:'LoginModal',dashboard:'UserDashboard',pageHeader:'AddUserHeader'});
  }
});
 //No any other routes for sign up has been configured.

//我收到的错误

(Mail not sent; to enable sending, set the MAIL_URL environment variable.)
I20170311-20:56:01.885(5.5)? MIME-Version: 1.0
I20170311-20:56:01.886(5.5)? Date: Sat, 11 Mar 2017 15:26:01 +0000
 I20170311-20:56:01.887(5.5)? From: "Meteor Accounts" <no-reply@meteor.com>

如何设置此功能以将电子邮件发送到创建的用户的电子邮件。我应该在哪里写发件人的电子邮件地址?

【问题讨论】:

  • 你发布的代码看起来不错..你能展示你如何配置路线的代码吗?尝试评论内容以查看问题何时消失。 This projcet 正在使用 AccountsTemplates,如果你想与之比较的话。
  • 我现在在户外。我一回到家就会发布代码。难道不需要在代码中的某处包含发件人的电子邮件地址吗?我没有在任何地方做过所以我想知道 tge 电子邮件是如何发送的……
  • AccountsTemplates 处理所有这些。您需要的是一个 url,否则它将在服务器日志(终端)上打印电子邮件。
  • @mutdmour 谢谢..我用路线代码编辑了我的问题。希望你找到错误。
  • 我对代码做了一些更改。现在显示了一个新错误。我在问题中添加了它。如何设置网址?

标签: meteor meteor-accounts


【解决方案1】:

meteorpedia

Meteor.startup(function () {
  process.env.MAIL_URL = 'smtp://postmaster%40meteorize.mailgun.org:YOURPASSWORD@smtp.mailgun.org:587';
});

【讨论】:

  • 我复制了代码并粘贴到服务器文件夹中的一个文件中。然后我尝试注册用户。然后我收到此错误“调用方法'ATCreateUserServer' AuthError 时出现异常:登录无效 - 535 5.7。 0 Mailgun 不喜欢您的登录名或密码”
  • 这是您收到电子邮件时的“发件人”地址。你注册了mailgun吗?此网址适用于在 mailgun 上拥有帐户的开发人员。 Here's how you can do the same with gmail
  • 虽然这段代码 sn-p 可以解决问题,including an explanation 确实有助于提高您的帖子质量。请记住,您是在为将来的读者回答问题,而这些人可能不知道您提出代码建议的原因。
  • 谢谢。我的 gmail 是 dileka.14@cse.mrt.ac.lk。我不知道要填写的用户名..
  • 我在 mailgun 上注册了,效果很好。感谢您的建议。
猜你喜欢
  • 2023-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-22
  • 1970-01-01
  • 1970-01-01
  • 2013-10-29
  • 2014-02-10
相关资源
最近更新 更多