Meteor Email undefined

After adding the Meteor email package and restarting the server (for a good grade), I do this:

Template.messaging.events({ 'click #send-message' : function () { Email.send({ from: ' test@gmail.com ', to: ' test2@gmail.com ', html: 'heyo buddy.' }); } }); 

When I fire the event, the console spits out:

 Uncaught ReferenceError: Email is not defined 

The docs say that even unconfigured, Email.send () should output to standard output. I get the same deployment problem in meteor.com that should be automatically configured using Mailgun.

Any ideas?

+1
javascript email meteor
source share
1 answer

As mentioned in docs , email is only a server-side package. You are trying to call it on the client side in a template callback. I suggest you move the above calls to the server method via Meteor.methods and then call it on the client side via Meteor.call

+7
source share

All Articles