public function execute()
    {
        $addresses = $this->getEmailAddresses();

        // Without some email addresses in the yml file then we
        // can't do anything.
        if (count($addresses) == 0) {
            return false;
        }

        $buildStatus  = $this->build->isSuccessful() ? "Passing Build" : "Failing Build";
        $projectName  = $this->build->getProject()->getTitle();

        try {
            $view = $this->getMailTemplate();
        } catch (Exception $e) {
            $this->phpci->log(
                sprintf('Unknown mail template "%s", falling back to default.', $this->options['template']),
                LogLevel::WARNING
            );
            $view = $this->getDefaultMailTemplate();
        }

        $view->build = $this->build;
        $view->project = $this->build->getProject();

        $layout = new View('Email/layout');
        $layout->build = $this->build;
        $layout->project = $this->build->getProject();
        $layout->content = $view->render();
        $body = $layout->render();

        $sendFailures = $this->sendSeparateEmails(
            $addresses,
            sprintf("PHPCI - %s - %s", $projectName, $buildStatus),
            $body
        );

        // This is a success if we've not failed to send anything.
        $this->phpci->log(Lang::get('n_emails_sent', (count($addresses) - $sendFailures)));
        $this->phpci->log(Lang::get('n_emails_failed', $sendFailures));

        return ($sendFailures === 0);
    }
public function execute()
    {
        $addresses = $this->getEmailAddresses();

        // Without some email addresses in the yml file then we
        // can't do anything.
        if (count($addresses) == 0) {
            return false;
        }

        $buildStatus  = $this->build->isSuccessful() ? "Passing Build" : "Failing Build";
        $projectName  = $this->build->getProject()->getTitle();

        try {
            $view = $this->getMailTemplate();
        } catch (Exception $e) {
            $this->phpci->log(
                sprintf('Unknown mail template "%s", falling back to default.', $this->options['template']),
                LogLevel::WARNING
            );
            $view = $this->getDefaultMailTemplate();
        }

        $view->build = $this->build;
        $view->project = $this->build->getProject();

        $layout = new View('Email/layout');
        $layout->build = $this->build;
        $layout->project = $this->build->getProject();
        $layout->content = $view->render();
        $body = $layout->render();

        $sendFailures = $this->sendSeparateEmails(
            $addresses,
            sprintf("PHPCI - %s - %s", $projectName, $buildStatus),
            $body
        );

        // This is a success if we've not failed to send anything.
        $this->phpci->log(Lang::get('n_emails_sent', (count($addresses) - $sendFailures)));
        $this->phpci->log(Lang::get('n_emails_failed', $sendFailures));

        return ($sendFailures === 0);
    }
public function execute ( ) { $ addresses = $ this -> getEmailAddresses ( ) ; // Without some email addresses in the yml file then we // can't do anything. if ( count ( $ addresses ) == 0 ) { return false ; } $ buildStatus = $ this -> build -> isSuccessful ( ) ? "Passing Build" : "Failing Build" ; $ projectName = $ this -> build -> getProject ( ) -> getTitle ( ) ; try { $ view = $ this -> getMailTemplate ( ) ; } catch ( Exception $ e ) { $ this -> phpci -> log ( sprintf ( 'Unknown mail template "%s", falling back to default.' , $ this -> options [ 'template' ] ) , LogLevel :: WARNING ) ; $ view = $ this -> getDefaultMailTemplate ( ) ; } $ view -> build = $ this -> build ; $ view -> project = $ this -> build -> getProject ( ) ; $ layout = new View ( 'Email/layout' ) ; $ layout -> build = $ this -> build ; $ layout -> project = $ this -> build -> getProject ( ) ; $ layout -> content = $ view -> render ( ) ; $ body = $ layout -> render ( ) ; $ sendFailures = $ this -> sendSeparateEmails ( $ addresses , sprintf ( "PHPCI - %s - %s" , $ projectName , $ buildStatus ) , $ body ) ; // This is a success if we've not failed to send anything. $ this -> phpci -> log ( Lang :: get ( 'n_emails_sent' , ( count ( $ addresses ) - $ sendFailures ) ) ) ; $ this -> phpci -> log ( Lang :: get ( 'n_emails_failed' , $ sendFailures ) ) ; return ( $ sendFailures === 0 ) ; }
Send a notification mail.
Send a notification mail .