Template not binding too its template data #59
Description
I am integrating your email template package and I am having a issue with databinding. I copied your example email template into my project. If I preview or send using the url - the email template shows up perfectly and the Beatles names are all listed.
However, if i use Mailer.send (see below) - to send the same template. The email shows up - however, the Beatles list is not in the template. I am invoking a server side meteor method using Meteor.call from the client. I can call methods defined in the template like capitalizedName - but binding to data defined in the route.data portion of the template is empty. Any ideas?
if( Meteor.isServer) {
Meteor.methods({
sendTestMail: function () {
console.log("sendTestMail entered");
Mailer.send({
to: '[email protected]',
subject: 'My Test',
template: 'sample',
data: {
//user: 'user1',
//team: 'Team1'
}
})
}
});
}
Here is the template:
Templates.sample = {
path: 'sample-email/template.html', // Relative to the 'private' dir.
scss: 'sample-email/style.scss', // Mail specific SCSS.
helpers: {
capitalizedName : function() {
//return this.name.charAt(0).toUpperCase() + this.name.slice(1);
return "testcapname";
},
myData : function() {
return Products.featured();
}
},
route: {
path: '/sample/:name',
data: function(params) {
return {
name: params.name,
names: ['Johan', 'John', 'Paul', 'Ringo'],
testdata: ["Blah1", "Blah2"],
test: "this is a test piece of data from the template"
};
}
}
};