protected function doRender(FilterPreRenderEvent $preEvent, MailInterface $mail)
    {
        $variables = $preEvent->getVariables();
        $variables['_mail_type'] = $mail->getType();
        $variables['_layout'] = null !== $mail->getLayout() ? $mail->getLayout()->getName() : null;
        $subject = $this->renderTemplate($mail->getSubject(), $mail, $variables);
        $variables['_subject'] = $subject;
        $htmlBody = $this->renderTemplate($mail->getHtmlBody(), $mail, $variables);
        $variables['_html_body'] = $htmlBody;
        $body = $this->renderTemplate($mail->getBody(), $mail, $variables);
        $variables['_body'] = $body;

        $layout = $this->getTranslatedLayout($mail);

        if (null !== $layout && null !== ($lBody = $layout->getBody()) && !MailUtil::isRootBody($htmlBody)) {
            $htmlBody = $this->renderTemplate($lBody, $layout, $variables);
        }

        return new MailRendered($mail, $subject, $htmlBody, $body);
    }
protected function doRender(FilterPreRenderEvent $preEvent, MailInterface $mail)
    {
        $variables = $preEvent->getVariables();
        $variables['_mail_type'] = $mail->getType();
        $variables['_layout'] = null !== $mail->getLayout() ? $mail->getLayout()->getName() : null;
        $subject = $this->renderTemplate($mail->getSubject(), $mail, $variables);
        $variables['_subject'] = $subject;
        $htmlBody = $this->renderTemplate($mail->getHtmlBody(), $mail, $variables);
        $variables['_html_body'] = $htmlBody;
        $body = $this->renderTemplate($mail->getBody(), $mail, $variables);
        $variables['_body'] = $body;

        $layout = $this->getTranslatedLayout($mail);

        if (null !== $layout && null !== ($lBody = $layout->getBody()) && !MailUtil::isRootBody($htmlBody)) {
            $htmlBody = $this->renderTemplate($lBody, $layout, $variables);
        }

        return new MailRendered($mail, $subject, $htmlBody, $body);
    }
protected function doRender ( FilterPreRenderEvent $ preEvent , MailInterface $ mail ) { $ variables = $ preEvent -> getVariables ( ) ; $ variables [ '_mail_type' ] = $ mail -> getType ( ) ; $ variables [ '_layout' ] = null !== $ mail -> getLayout ( ) ? $ mail -> getLayout ( ) -> getName ( ) : null ; $ subject = $ this -> renderTemplate ( $ mail -> getSubject ( ) , $ mail , $ variables ) ; $ variables [ '_subject' ] = $ subject ; $ htmlBody = $ this -> renderTemplate ( $ mail -> getHtmlBody ( ) , $ mail , $ variables ) ; $ variables [ '_html_body' ] = $ htmlBody ; $ body = $ this -> renderTemplate ( $ mail -> getBody ( ) , $ mail , $ variables ) ; $ variables [ '_body' ] = $ body ; $ layout = $ this -> getTranslatedLayout ( $ mail ) ; if ( null !== $ layout && null !== ( $ lBody = $ layout -> getBody ( ) ) && ! MailUtil :: isRootBody ( $ htmlBody ) ) { $ htmlBody = $ this -> renderTemplate ( $ lBody , $ layout , $ variables ) ; } return new MailRendered ( $ mail , $ subject , $ htmlBody , $ body ) ; }
Render the mail.

@param FilterPreRenderEvent $preEvent The template pre event
@param MailInterface        $mail     The mail

@return MailRendered
Render the mail .