Multiple Layouts?
manzoire opened this issue · comments
I'm trying to use multiple emails and not able to get it to work.
When I specify the layout as "false" in config as per your documentation, I get an error that says object expected. I removed that line and the error went away. Then I specified the layout in each file instead and the email is rendering without the layout.
I'm not sure if I'm missing something but it doesn't seem to work as the documentation suggests,.
Mailer.config({
from: 'John Doe <from@domain.com',
replyTo: 'John Doe <from@domain.com'
});
Meteor.startup(function() {
Mailer.init({
templates: EmailService.Templates, // Global Templates namespace, see lib/templates.js.
helpers: EmailService.TemplateHelpers // Global template helper namespace.
});
});
EmailService.Templates.welcome = {
path: 'emails/themes/metro/emails/welcome.html', // Relative to the 'private' dir.
scss: 'emails/themes/metro/emails/welcome.scss', // Mail specific SCSS.
layout: {
name: 'metro',
path: 'emails/themes/metro/layouts/header-footer.html', // Relative to 'private' dir.
scss: 'emails/themes/metro/layouts/layout.scss'
},
helpers: {
guestName: function() {
return this.guest.profile.firstName + ' ' + this.guest.profile.lastName
},
},
route: {
path: '/welcome/:name',
data: function() {
var hotel = {
name: 'Display Name',
geo: {
city: 'New York City'
}
}
var user = {
profile: {
firstName: "Joe",
lastName: "Shmoe"
}
}
return {
title: hotel.name + ' | Your Stay',
viewInBrowserUrl: "http://website.com",
imageUrl: "https://www.filepicker.io/api/file/ftJg8FHTxe3agtDzNlPA/convert?w=500&fit=scale&cache=true",
hotel: hotel,
guest: user,
preheaderTitle: hotel.name + ' | Control your stay'
};
}
}
};
@manzoire Sorry for the delay. Is this working for you now? (clone master
and try locally).