src/Listener/MailSender.php
protected function sendMail(Job $job, $template, $subject, $adminMail = false)
    {
        $mail = $this->mailer->get('htmltemplate');
        $mail->setTemplate($template)
             ->setSubject($subject)
             ->setVariables(
                 array(
                                'job'      => $job,
                                'siteName' => $this->options['siteName'],
                            )
             );

        if ($adminMail) {
            $mail->setTo($this->options['adminEmail']);
        } else {
            if (! ($user = $job->getUser())) {
                return;
            }
            $userInfo  = $user->getInfo();
            $userEmail = $userInfo->getEmail();
            $userName  = $userInfo->getDisplayName(/*emailIfEmpty*/ false);

            $mail->setTo($userEmail, $userName);
        }

        $this->mailer->send($mail);
    }
protected function sendMail(Job $job, $template, $subject, $adminMail = false)
    {
        $mail = $this->mailer->get('htmltemplate');
        $mail->setTemplate($template)
             ->setSubject($subject)
             ->setVariables(
                 array(
                                'job'      => $job,
                                'siteName' => $this->options['siteName'],
                            )
             );

        if ($adminMail) {
            $mail->setTo($this->options['adminEmail']);
        } else {
            if (! ($user = $job->getUser())) {
                return;
            }
            $userInfo  = $user->getInfo();
            $userEmail = $userInfo->getEmail();
            $userName  = $userInfo->getDisplayName(/*emailIfEmpty*/ false);

            $mail->setTo($userEmail, $userName);
        }

        $this->mailer->send($mail);
    }
protected function sendMail ( Job $ job , $ template , $ subject , $ adminMail = false ) { $ mail = $ this -> mailer -> get ( 'htmltemplate' ) ; $ mail -> setTemplate ( $ template ) -> setSubject ( $ subject ) -> setVariables ( array ( 'job' => $ job , 'siteName' => $ this -> options [ 'siteName' ] , ) ) ; if ( $ adminMail ) { $ mail -> setTo ( $ this -> options [ 'adminEmail' ] ) ; } else { if ( ! ( $ user = $ job -> getUser ( ) ) ) { return ; } $ userInfo = $ user -> getInfo ( ) ; $ userEmail = $ userInfo -> getEmail ( ) ; $ userName = $ userInfo -> getDisplayName ( /*emailIfEmpty*/ false ) ; $ mail -> setTo ( $ userEmail , $ userName ) ; } $ this -> mailer -> send ( $ mail ) ; }
Sends a job event related mail

@param Job    $job
@param string $template
@param string $subject
@param bool   $adminMail if true, the mail is send to the administrator instead of to the user.
Sends a job event related mail