Reputation: 13721
I want an email to be sent to a user after they register for the site. However, I keep getting the error:
I20150729-22:44:52.253(-4)? Exception while invoking method 'entryCreateUser' Error: Match error: Expected string, got undefined in field [0]
I20150729-22:44:52.254(-4)? at checkSubtree (packages/check/match.js:159:1)
I20150729-22:44:52.255(-4)? at packages/check/match.js:206:1
I20150729-22:44:52.255(-4)? at Array.forEach (native)
I20150729-22:44:52.255(-4)? at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
I20150729-22:44:52.255(-4)? at checkSubtree (packages/check/match.js:204:1)
I20150729-22:44:52.255(-4)? at check (packages/check/match.js:32:1)
I20150729-22:44:52.255(-4)? at [object Object].Meteor.methods.sendEmail (app/server/methods/email.js:3:5)
I20150729-22:44:52.255(-4)? at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
I20150729-22:44:52.255(-4)? at packages/ddp/livedata_server.js:1530:1
I20150729-22:44:52.255(-4)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150729-22:44:52.256(-4)? Sanitized and reported to the client as: Match failed [400]
Here is my onCreateUser method:
Accounts.onCreateUser(function(options, user) {
var userEmail = user.email
var emailSubject = "Welcome to Company!";
var emailBody = "SUP";
Meteor.call('sendEmail',
userEmail,
'',
'',
emailSubject,
emailBody
);
});
Can someone help?
Thanks!!
Upvotes: 0
Views: 583
Reputation: 20226
You'll want to look at the collection-hooks package to trigger code right after the user document has been created. It's also useful for modifying the user document itself before it is stored. Of course it can be used for any collection, not just users.
Upvotes: 1