Render email from address

@param  EmailInterface $email
@param  array          $parameters

@return string
186568
protected function renderFromAddress(EmailInterface $email, array $parameters = array())
    {
        if (null === $email->getFromAddress()) {
            return $this->options['admin_email'];
        }

        return $this->renderTemplate('from_address', $parameters, $email->getChecksum());
    }
632546
public function loadByEmail($email)
    {
        $query = $this->handler->createSelectQuery();
        $query->select(
            $this->handler->quoteColumn('contentobject_id', 'ezuser'),
            $this->handler->quoteColumn('login', 'ezuser'),
            $this->handler->quoteColumn('email', 'ezuser'),
            $this->handler->quoteColumn('password_hash', 'ezuser'),
            $this->handler->quoteColumn('password_hash_type', 'ezuser'),
            $this->handler->quoteColumn('is_enabled', 'ezuser_setting'),
            $this->handler->quoteColumn('max_login', 'ezuser_setting')
        )->from(
            $this->handler->quoteTable('ezuser')
        )->leftJoin(
            $this->handler->quoteTable('ezuser_setting'),
            $query->expr->eq(
                $this->handler->quoteColumn('user_id', 'ezuser_setting'),
                $this->handler->quoteColumn('contentobject_id', 'ezuser')
            )
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('email', 'ezuser'),
                $query->bindValue($email, null, \PDO::PARAM_STR)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(\PDO::FETCH_ASSOC);
    }
372380
public function render(ElementInterface $element): string
    {
        $field = $this->factory->create($element->type())
            ->render($element);

        $errors = $element instanceof ErrorAwareInterface
            ? $this->factory->create(Errors::class)
                ->render($element)
            : '';

        $description = $element instanceof DescriptionAwareInterface
            ? $this->factory->create(Description::class)
                ->render($element)
            : '';

        $label = $element instanceof LabelAwareInterface
            ? $this->factory->create(Label::class)
                ->render($element)
            : '';

        $html = ($label !== '')
            ? sprintf(
                '<th>%1$s</th><td>%2$s %3$s %4$s</td>',
                $label,
                $field,
                $description,
                $errors
            )
            : sprintf(
                '<td colspan="2">%1$s %2$s %3$s</td>',
                $field,
                $description,
                $errors
            );

        $rowAttributes = [
            'class' => 'form-row'.($errors === ''
                    ? ''
                    : ' form-row--has-errors'),
        ];

        return '<tr '.$this->attributesToString($rowAttributes).'>'.$html.'</tr>';
    }
784391
public function renderWithExtraParams($view, array $parameters = [], Response $response = null)
    {
        if (!$this->isXmlHttpRequest()) {
            $parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder');
        }
        $parameters['admin'] = $parameters['admin'] ??
            $this->admin;

        $parameters['base_template'] = $parameters['base_template'] ??
            $this->getBaseTemplate();

        $parameters['admin_pool'] = $this->get('sonata.admin.pool');

        //NEXT_MAJOR: Remove method alias and use $this->render() directly.
        return $this->originalRender($view, $parameters, $response);
    }
468666
public function generateMessage(EmailInterface $email, $to, array $parameters = array(), $locale = null)
    {
        if (null === $locale) {
            $locale = $this->options['default_locale'];
        }

        if (is_object($to)) {
            $to = $this->getRecipient($to);
        }

        try {
            $email->setLocale($locale);
            $this->renderer->loadTemplates($email);

            $message = $this->createMessageInstance()
                            ->setSubject($this->renderTemplate('subject', $parameters, $email->getChecksum()))
                            ->setFrom($this->renderFromAddress($email, $parameters), $this->renderTemplate('from_name', $parameters, $email->getChecksum()))
                            ->setTo($to)
                            ->setBody($this->renderTemplate('html_content', $parameters, $email->getChecksum()), 'text/html');

            $textContent = $this->renderTemplate('text_content', $parameters, $email->getChecksum());

            if (null !== $textContent && '' !== $textContent) {
                $message->addPart($textContent, 'text/plain');
            }

            foreach ($email->getBccs() as $bcc) {
                $message->addBcc($bcc);
            }

            if (count($email->getHeaders()) > 0) {
                $headers = $message->getHeaders();
                foreach ($email->getHeaders() as $header) {
                    if (is_array($header) && isset($header['key'], $header['value'])) {
                        $headers->addTextHeader($header['key'], $header['value']);
                    }
                }
            }

        } catch (NoTranslationException $e) {
            $message = new NoTranslationMessage($email->getReference(), $locale);
            $message->setFrom($this->options['admin_email']);
            $message->setTo($this->options['admin_email']);

        } catch (\Twig_Error_Runtime $e) {
            $message = new UndefinedVariableMessage($e->getMessage(), $email->getReference());
            $message->setFrom($this->options['admin_email']);
            $message->setTo($this->options['admin_email']);

        } catch (\Twig_Error $e) {
            $message = new TwigErrorMessage($e->getRawMessage(), $email->getReference());
            $message->setFrom($this->options['admin_email']);
            $message->setTo($this->options['admin_email']);
        }

        return $message;
    }
1345166
function renderEmailValidationLogsField( $args ) {
		$this->renderRadioButtons(
			[
				'id' => 'email_validation_logs',
				'name' => $this->getSlug(),
				'option' => 'email_validation_logs',
				'value' => ( isset( $this->options['email_validation_logs'] ) ) ? $this->options['email_validation_logs'] : '',
				'choices' => $args,
			]
		);
	}
170533
public function renderWithExtraParams($view, array $parameters = [], Response $response = null)
    {
        if (array_key_exists('action', $parameters) && $parameters['action'] == 'edit') {
            $event = new CmsEvent($parameters['object']);

            $this->dispatcher->dispatch(self::EDIT_ENTITY, $event);
        }

        return parent::renderWithExtraParams($view, $parameters, $response);
    }
1085973
public function render_html_email(
		Vulnerabilities $vulnerabilities,
		CssToInlineStyles $inliner = null
	) {
		$html = $this->template->render( 'emails/html/vulnerable.php', [
			'action_url' => admin_url( 'update-core.php' ),
			'vulnerabilities' => $vulnerabilities,
		] );
		$css = $this->template->render( 'emails/style.css' );
		$inliner = $inliner ?: new CssToInlineStyles();

		return $inliner->convert( $html, $css );
	}
1187979
public function renderResponse($view, array $parameters = array(), Response $response = null)
    {
        return $this->getTemplating()->renderResponse($view, $parameters, $response);
    }
404677
private function render($template, array $parameters = [])
    {
        if (!isset($this->resources[$template])) {
            $this->resources[$template] = $this->environment->loadTemplate($template);
        }

        return $this->resources[$template]->render($parameters);
    }
859722
public function translate($message, $parameters = array())
    {
        if (count($parameters) === 0) {
            return $this->translations[$message];
        } else {
            return vsprintf($this->translations[$message], $parameters);
        }
    }
99155
public function send( $mail, $parameters = array() )
	{
		$body		= $mail->getBody();
		$headers	= $mail->getHeaders();
		$receiver	= $mail->getReceiver();
		$subject	= $mail->getSubject();

		//  --  VALIDATION & SECURITY CHECK  --  //
		$this->checkForInjection( $receiver );
		$this->checkForInjection( $subject );
		if( !$headers->hasField( 'From' ) )
			throw new InvalidArgumentException( 'No mail sender defined' );
		if( !$receiver )
			throw new InvalidArgumentException( 'No mail receiver defined' );
		if( !$subject )
			throw new InvalidArgumentException( 'No mail subject defined' );
		$subject	= "=?UTF-8?B?".base64_encode( $subject )."?=";

/*		foreach( $headers as $key => $value )
		{
			$this->checkForInjection( $key );
			$this->checkForInjection( $value );
		}
*/
		//  --  HEADERS  --  //
//		if( $this->mailer )
		$headers->setFieldPair( 'X-Mailer', $this->mailer, TRUE );
		$headers->setFieldPair( 'Date', date( 'r' ), TRUE );

		if( is_array( $parameters ) )
			$parameters	= implode( PHP_EOL, $parameters );

		if( !mail( $receiver, $subject, $body, $headers->toString(), $parameters ) )
			throw new RuntimeException( 'Mail could not been sent' );
	}
79325
public function renderHtml($template, array $variables = [], $type = MailTypes::TYPE_ALL)
    {
        return $this->getMailRendered($template, $variables, $type)->getHtmlBody();
    }
1101774
public static function search($email, ClientInterface $client = null)
    {

        $response = (new static([], $client))
            ->getClient()
            ->setResourceKey(static::RESOURCE_NAME)
            ->send('/v1/customers/search', 'GET', ['email' => $email]);

        return static::fromArray($response, $client);
    }
970119
protected function render(string $template, array $parameters): string
    {
        $twig = new Environment(
            new FilesystemLoader([$this->skeletonDir]),
            [
                'debug' => true,
                'cache' => false,
                'strict_variables' => true,
                'autoescape' => false,
            ]
        );

        return $twig->render($template, $parameters);
    }
505976
public function renderImage( $email, $attributes = array() ){
		$attributes['src']		= $this->getUrl( $email );
		$attributes['width']	= $this->size;
		$attributes['height']	= $this->size;
		return UI_HTML_Tag::create( 'img', NULL, $attributes );
	}
809472
private function render($view, array $parameters = [])
    {
        $response = new LegacyResponse();
        $response->setContent($this->templateEngine->render($view, $parameters));

        return $response;
    }