/** * Load all the template variables into the internal variables, including * the template into body. Called before send() or debugSend() * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used * and it won't be plain email :) * * @param bool $isPlain * @return $this */ protected function parseVariables($isPlain = false) { $origState = SSViewer::config()->get('source_file_comments'); SSViewer::config()->update('source_file_comments', false); if (!$this->parseVariables_done) { $this->parseVariables_done = true; // Parse $ variables in the base parameters $this->templateData(); // Process a .SS template file $fullBody = $this->body; if ($this->ss_template && !$isPlain) { // Requery data so that updated versions of To, From, Subject, etc are included $data = $this->templateData(); $candidateTemplates = [$this->ss_template, ['type' => 'email', $this->ss_template]]; $template = new SSViewer($candidateTemplates); if ($template->exists()) { $fullBody = $template->process($data); } } // Rewrite relative URLs $this->body = HTTP::absoluteURLs($fullBody); } SSViewer::config()->update('source_file_comments', $origState); return $this; }