Using SilverStripe 4.12
I have a ContactPage and it has an AJAX form on there that sends emails. In my ContactPage_Controller I have the email template generated like this:
$emailBody = $this->customise([
'Layout' => $this->customise($templateData)->renderWith(['MyModule\Layout\Contact_Email'])])->renderWith(['Email']);
However, because ContactPage_Controller has a javascript requirement, it includes this javascript reference in the email html source which is very bad regarding anti-spam filters.
protected function init() {
parent::init();
Requirements::set_force_js_to_bottom(true);
Requirements::javascript("themes/mytheme/js/contact.js");
}
I’m a bit clueless as to exclude the script from the email template rendering.