Prevent prependFile, appendFile and cache in FrontendUserRegisterEmailValidation

Issue #4 resolved
pwFoo repo owner created an issue

Hi again,

I think we found a bug regarding the emailValidation E-mail: The email contains some markup residue which is pulled from the _main.php file (for example some google analytics script code), even if sent as text email. If the vars for the render() func contain

$vars['prependFile'] = null;
$vars['appendFile'] = null;
$vars['allowCache'] = false;

this is gone.

Is there a way to insert this via hook, or only in FrontendUserRegisterEmailValidation.module, line 97ff…?

// Set email template variables
            $vars = array(
                'username'  => wire('session')->get('registerUsername'),
                'email'     => wire('session')->get('registerEmail'),
                'token'     => wire('session')->get('registerToken'),
                'url'       => wire('page')->httpUrl . '?registerToken=' . wire('session')->get('registerToken'),
                'content'   => $this->content,  // config variable  // ToDo: Tests with php 5.3
                // no markup from page template:
                'prependFile' => null,
                'appendFile' => null
                // ---- //
            );

            // Load the plain / html email templates
            $emailContentHtml = wire('page')->render(wire('fu')->getFile('validationEmail.php', 'templates'), $vars);

            // Send verification email with the generated token
            $mail = wireMail();
            $mail->to($form->fhValue('email'))->subject($subject);
            if ((int)$this->emailType == 1) {
                $mail->bodyHTML($emailContentHtml);
            }
            else {
                $emailContentPlain = preg_replace('/^\h+|\h+$/m', '', strip_tags($emailContentHtml));
                $mail->body($emailContentPlain);
            }
            $mail->send();