I have this html in the private folder
<head> <link href="order-confirmation.css" media="all" rel="stylesheet" type="text/css" /> </head> <body> <h4>Hello {{firstName}} {{lastName}},</h4> <h4>Shipping Address:</h4> <div> {{#each addressView}} <b>{{first_name}} {{last_name}}</b> <br> {{address_line_1}} <br> {{address_line_2}} <br> {{city}}, {{state}} {{zip}} <br> {{country}} <br> {{/each}} </span> <br> </body>
Here’s the js in server
SSR.compileTemplate('orderConfirmationEmail', Assets.getText('order-confirmation.html'));
Template.orderConfirmationEmail.helpers({ addressView() { return Address.find({ owner: this.userId, }, { sort: { added_on: -1, }, limit: 1, }); }, });
. . .
Meteor.methods({ checkout(shipping) { const customerText = SSR.render('orderConfirmationEmail', { firstName: Meteor.user().profile.firstName, lastName: Meteor.user().profile.lastName, });
this.unblock();
// Send the e-mail Email.send({ to: 'xxx', cc: 'xxx', subject: 'Test', html: customerText, }); console.log('Success'); }, });
The {{firstName}} and {{lastName}} get rendered correctly, but the addressView doesn’t.
Even tried this
const customerText = SSR.render('orderConfirmationEmail', { firstName: Meteor.user().profile.firstName, lastName: Meteor.user().profile.lastName, addressView: Address.find({ owner: this.userId, }, { sort: { added_on: -1, }, limit: 1, }), });
Thanks in advance