classes/phing/listener/MailLogger.php
public function buildFinished(BuildEvent $event)
    {
        parent::buildFinished($event);

        $project = $event->getProject();
        $properties = $project->getProperties();

        $filename = $properties['phing.log.mail.properties.file'];

        // overlay specified properties file (if any), which overrides project
        // settings
        $fileProperties = new Properties();
        $file = new PhingFile($filename);

        try {
            $fileProperties->load($file);
        } catch (IOException $ioe) {
            // ignore because properties file is not required
        }

        foreach ($fileProperties as $key => $value) {
            $properties['key'] = $project->replaceProperties($value);
        }

        $success = $event->getException() === null;
        $prefix = $success ? 'success' : 'failure';

        try {
            $notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on'));
            if (!$notify) {
                return;
            }

            if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) {
                $defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject');
            } else {
                $defaultSubject = ($success) ? 'Build Success' : 'Build Failure';
            }
            $hdrs = [];
            $hdrs['From'] = $this->getValue($properties, 'from', $this->from);
            $hdrs['Reply-To'] = $this->getValue($properties, 'replyto', '');
            $hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', '');
            $hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', '');
            $hdrs['Body'] = $this->getValue($properties, $prefix . '.body', '');
            $hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject);
            $tolist = $this->getValue($properties, $prefix . '.to', $this->tolist);
        } catch (BadMethodCallException $e) {
            $project->log($e->getMessage(), Project::MSG_WARN);
        }

        if (empty($tolist)) {
            return;
        }

        $mail = Mail::factory('mail');
        $mail->send($tolist, $hdrs, $this->mailMessage);
    }
public function buildFinished(BuildEvent $event)
    {
        parent::buildFinished($event);

        $project = $event->getProject();
        $properties = $project->getProperties();

        $filename = $properties['phing.log.mail.properties.file'];

        // overlay specified properties file (if any), which overrides project
        // settings
        $fileProperties = new Properties();
        $file = new PhingFile($filename);

        try {
            $fileProperties->load($file);
        } catch (IOException $ioe) {
            // ignore because properties file is not required
        }

        foreach ($fileProperties as $key => $value) {
            $properties['key'] = $project->replaceProperties($value);
        }

        $success = $event->getException() === null;
        $prefix = $success ? 'success' : 'failure';

        try {
            $notify = StringHelper::booleanValue($this->getValue($properties, $prefix . '.notify', 'on'));
            if (!$notify) {
                return;
            }

            if (is_string(Phing::getDefinedProperty('phing.log.mail.subject'))) {
                $defaultSubject = Phing::getDefinedProperty('phing.log.mail.subject');
            } else {
                $defaultSubject = ($success) ? 'Build Success' : 'Build Failure';
            }
            $hdrs = [];
            $hdrs['From'] = $this->getValue($properties, 'from', $this->from);
            $hdrs['Reply-To'] = $this->getValue($properties, 'replyto', '');
            $hdrs['Cc'] = $this->getValue($properties, $prefix . '.cc', '');
            $hdrs['Bcc'] = $this->getValue($properties, $prefix . '.bcc', '');
            $hdrs['Body'] = $this->getValue($properties, $prefix . '.body', '');
            $hdrs['Subject'] = $this->getValue($properties, $prefix . '.subject', $defaultSubject);
            $tolist = $this->getValue($properties, $prefix . '.to', $this->tolist);
        } catch (BadMethodCallException $e) {
            $project->log($e->getMessage(), Project::MSG_WARN);
        }

        if (empty($tolist)) {
            return;
        }

        $mail = Mail::factory('mail');
        $mail->send($tolist, $hdrs, $this->mailMessage);
    }
public function buildFinished ( BuildEvent $ event ) { parent :: buildFinished ( $ event ) ; $ project = $ event -> getProject ( ) ; $ properties = $ project -> getProperties ( ) ; $ filename = $ properties [ 'phing.log.mail.properties.file' ] ; // overlay specified properties file (if any), which overrides project // settings $ fileProperties = new Properties ( ) ; $ file = new PhingFile ( $ filename ) ; try { $ fileProperties -> load ( $ file ) ; } catch ( IOException $ ioe ) { // ignore because properties file is not required } foreach ( $ fileProperties as $ key => $ value ) { $ properties [ 'key' ] = $ project -> replaceProperties ( $ value ) ; } $ success = $ event -> getException ( ) === null ; $ prefix = $ success ? 'success' : 'failure' ; try { $ notify = StringHelper :: booleanValue ( $ this -> getValue ( $ properties , $ prefix . '.notify' , 'on' ) ) ; if ( ! $ notify ) { return ; } if ( is_string ( Phing :: getDefinedProperty ( 'phing.log.mail.subject' ) ) ) { $ defaultSubject = Phing :: getDefinedProperty ( 'phing.log.mail.subject' ) ; } else { $ defaultSubject = ( $ success ) ? 'Build Success' : 'Build Failure' ; } $ hdrs = [ ] ; $ hdrs [ 'From' ] = $ this -> getValue ( $ properties , 'from' , $ this -> from ) ; $ hdrs [ 'Reply-To' ] = $ this -> getValue ( $ properties , 'replyto' , '' ) ; $ hdrs [ 'Cc' ] = $ this -> getValue ( $ properties , $ prefix . '.cc' , '' ) ; $ hdrs [ 'Bcc' ] = $ this -> getValue ( $ properties , $ prefix . '.bcc' , '' ) ; $ hdrs [ 'Body' ] = $ this -> getValue ( $ properties , $ prefix . '.body' , '' ) ; $ hdrs [ 'Subject' ] = $ this -> getValue ( $ properties , $ prefix . '.subject' , $ defaultSubject ) ; $ tolist = $ this -> getValue ( $ properties , $ prefix . '.to' , $ this -> tolist ) ; } catch ( BadMethodCallException $ e ) { $ project -> log ( $ e -> getMessage ( ) , Project :: MSG_WARN ) ; } if ( empty ( $ tolist ) ) { return ; } $ mail = Mail :: factory ( 'mail' ) ; $ mail -> send ( $ tolist , $ hdrs , $ this -> mailMessage ) ; }
Sends the mail

@see   DefaultLogger#buildFinished
@param BuildEvent $event
Sends the mail