verify email using accounts.ui package

后端 未结 3 1352
挽巷
挽巷 2021-02-14 09:45

I want to send a verification email when some user is created. I use the accounts-password package, so any Accounts methods are called in my code.

I read in documentati

3条回答
  •  一个人的身影
    2021-02-14 10:21

    sendVerificationEmail is only available server-side. What I usually do is to use a setInterval inside onCreateUser to wait for Meteor to create the user before sending an email.

    Read More: Verify an Email with Meteor Accounts.

    // (server-side)
    Accounts.onCreateUser(function(options, user) {  
      user.profile = {};
    
      // we wait for Meteor to create the user before sending an email
      Meteor.setTimeout(function() {
        Accounts.sendVerificationEmail(user._id);
      }, 2 * 1000);
    
      return user;
    });
    

提交回复
热议问题