bundle/Helper/MailHelper.php
public function sendMail($receivers, string $subject, string $template, array $templateParameters = [], $sender = null): int
    {
        try {
            $sender = $this->getSender($sender);
        } catch (InvalidArgumentException $e) {
            $this->logger->error($e->getMessage());

            return -1;
        }

        $body = $this->twig->render($template, $templateParameters + $this->getDefaultTemplateParameters());

        $subject = $this->translator->trans($subject, [], 'ngsite_mail');

        $message = new Swift_Message();

        $message
            ->setTo($receivers)
            ->setSubject($this->siteName . ': ' . $subject)
            ->setBody($body, 'text/html');

        $message->setSender($sender);
        $message->setFrom($sender);

        return $this->mailer->send($message);
    }
public function sendMail($receivers, string $subject, string $template, array $templateParameters = [], $sender = null): int
    {
        try {
            $sender = $this->getSender($sender);
        } catch (InvalidArgumentException $e) {
            $this->logger->error($e->getMessage());

            return -1;
        }

        $body = $this->twig->render($template, $templateParameters + $this->getDefaultTemplateParameters());

        $subject = $this->translator->trans($subject, [], 'ngsite_mail');

        $message = new Swift_Message();

        $message
            ->setTo($receivers)
            ->setSubject($this->siteName . ': ' . $subject)
            ->setBody($body, 'text/html');

        $message->setSender($sender);
        $message->setFrom($sender);

        return $this->mailer->send($message);
    }
public function sendMail ( $ receivers , string $ subject , string $ template , array $ templateParameters = [ ] , $ sender = null ) : int { try { $ sender = $ this -> getSender ( $ sender ) ; } catch ( InvalidArgumentException $ e ) { $ this -> logger -> error ( $ e -> getMessage ( ) ) ; return - 1 ; } $ body = $ this -> twig -> render ( $ template , $ templateParameters + $ this -> getDefaultTemplateParameters ( ) ) ; $ subject = $ this -> translator -> trans ( $ subject , [ ] , 'ngsite_mail' ) ; $ message = new Swift_Message ( ) ; $ message -> setTo ( $ receivers ) -> setSubject ( $ this -> siteName . ': ' . $ subject ) -> setBody ( $ body , 'text/html' ) ; $ message -> setSender ( $ sender ) ; $ message -> setFrom ( $ sender ) ; return $ this -> mailer -> send ( $ message ) ; }
Sends an mail.

Receivers can be:
a string: info@netgen.hr
or:
array( 'info@netgen.hr' => 'Netgen Site' ) or
array( 'info@netgen.hr', 'example@netgen.hr' ) or
array( 'info@netgen.hr' => 'Netgen Site', 'example@netgen.hr' => 'Example' )

Sender can be:
a string: info@netgen.hr
an array: array( 'info@netgen.hr' => 'Netgen Site' )

@param mixed $receivers
@param mixed|null $sender
Sends an mail .