2
votes

I am using Meteor accounts core package to create new users and send them verification email, but I am facing a problem as when I call Accounts.createUser from server side as a method, no verification email is sent, however if I called Accounts.createUser from the client side new accounts are created and a verification link is sent to the client...can someone please tell me what I might be missing / doing wrong here? Thanks

Accounts.createUser({email: adminData.email, password : adminData.password});
1

1 Answers

3
votes

So some clues and tips. Normally Accounts.createUser will not sent out verification emails and that it does that in one case (client side) and not in the other case (server side) is a little strange. Normally it would only sent out verification emails when you have

Accounts.config({
    sendVerificationEmail: true
});

on the server side (see http://docs.meteor.com/#/full/accounts_config). So first you should check that and maybe that already solves your problem.

When this isn't set the only other way an verification email got sent out should be calling Accounts.sendVerificationEmail (see http://docs.meteor.com/#/full/accounts_sendverificationemail) but this is only possible server side. So to make use of that client side you would need to write a server side method with it and call that via Meteor.call from the client side. However if you can't find your problem you could also use that to work around it by using Accounts.sendVerificationEmail within Accounts.onCreateUser (see http://docs.meteor.com/#/full/accounts_oncreateuser) on the server side. Or after you call Accounts.createUser server side as at that point you already know the users email address and the account already got created so that should work really well.

Oh and obviously the email package needs to be installed (http://docs.meteor.com/#/full/email) but as some mails already get sent out I guess that's the case.