如何使用userAccounts发送确认电子邮件,在流星

问题描述:

我试图设置电子邮件验证,一旦用户在我的应用程序注册,但我收到“内部服务器错误”账户密码如何使用userAccounts发送确认电子邮件,在流星

这里是我的代码来创建注册表格

<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" <[email protected]> 

我如何设置这个发送电子邮件到创建用户的email.Where的错误,我应该写发件人的电子邮件添加RESS?

+0

您发布的代码似乎罚款..你可以展示你的,你是如何配置的路由代码?尝试发表评论,看看问题何时消失。 [This projcet](https://github.com/meteor/todos)正在使用AccountsTemplates,如果你想比较它。 – mutdmour

+0

我现在outdoor.I将尽快发布代码回家。是否有必要在代码中包含发件人的电子邮件地址?我没有做到这一点所以我想知道如何tge电子邮件被发送... –

+0

AccountsTemplates处理所有这些。你需要的是一个URL,否则它将在服务器日志(终端)上打印电子邮件。 – mutdmour

meteorpedia

Meteor.startup(function() { 
    process.env.MAIL_URL = 'smtp://postmaster%40meteorize.mailgun.org:[email protected]:587'; 
}); 
+0

我复制了代码并粘贴到服务器文件夹中的一个文件中。然后我尝试注册一个用户。然后收到此错误“调用方法时出现异常'ATCreateUserServer'AuthError:无效登录 - 535 5.7.0 Mailgun不喜欢您的登录或密码“ –

+0

这是您收到电子邮件时的”发件人“地址。你是否注册了邮件枪?此网址适用于开发人员使用mailgun上的帐户。 [这里是你可以如何做到这一点与Gmail](https://*.com/questions/31438118/sending-email-using-gmail-smtp-meteorjs) – mutdmour

+1

虽然这段代码可以解决这个问题,[包括解释](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)确实有助于提高你的文章的质量。请记住,您将来会为读者回答问题,而这些人可能不知道您的代码建议的原因。 – DimaSan