What seems to be happening though is the mailservice plugin is emailing out the handler’s “success” view and appending those declared in the renderLayout on to the end. So opening the email I’m getting what they should see in the browser.
Maybe I’m misunderstanding how renderLayout works but is there anyway I can say “I want this view, with this layout and give it to the mail object”?
Changed things around a fair bit in the past 30 minutes so I’ve now got this …
rc.displayProp = {
// WARNING - It has to be kept in this running order for Gmail to display the HTML
html = {
name = ‘confirm/email.confirmation.HTML’,
noLayout = false,
layout = ‘Layout.Email.HTML’
},
plain = {
name = ‘confirm/email.confirmation.textOnly’,
noLayout = true,
layout = ‘’
}
};
// Request a new mail object and customise for this user
rc.objMailer = getMyPlugin(‘MailService’);
rc.objMail = rc.objMailer.newMail().config(
from = getSetting(‘email’).enrolment,
failTo = getSetting(‘email’).webTeam,
subject = getResource(‘email.confirmation.subject’)
);
// Add the email body ( text-only and HTML branded )
for(rc.key in rc.displayProp){
event.setView(argumentCollection=rc.displayProp[rc.key]);
rc.objMail.addMailPart(charset=‘utf-8’,type=‘text/#lcase(rc.key)#’,body=renderLayout());
}
// rc.results = rc.objMailer.send(rc.objMail);
// Reset the layout and view
event.setLayout(event.getDefaultLayout());
event.setView(name=listChangeDelims(event.getCurrentEvent(),’/’,’.’),layout=event.getDefaultLayout());