home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / phing / tasks / ext / MailTask.php < prev    next >
Encoding:
PHP Script  |  2006-03-10  |  2.3 KB  |  78 lines

  1. <?php
  2. /*
  3.  *  $Id: MailTask.php 43 2006-03-10 14:31:51Z mrook $
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the LGPL. For more information please see
  19.  * <http://phing.info>.
  20.  */
  21.  
  22. include_once 'phing/Task.php';
  23.  
  24. /**
  25.  *  Send a message by mail() 
  26.  *
  27.  *  <mail to="user@example.org" subject="build complete">The build process is a success...</mail> 
  28.  * 
  29.  *  @author   Francois Harvey at SecuriWeb (http://www.securiweb.net)
  30.  *  @version  $Revision: 1.1 $
  31.  *  @package  phing.tasks.ext
  32.  */
  33. class MailTask extends Task {
  34.  
  35.     protected $recipient;
  36.       
  37.     protected $subject;
  38.     
  39.     protected $msg;
  40.  
  41.     function main() {
  42.         $this->log('Sending mail to ' . $this->recipient );    
  43.         mail($this->recipient, $this->subject, $this->msg);
  44.     }
  45.  
  46.     /** setter for message */
  47.     function setMsg($msg) {
  48.         $this->setMessage($msg);
  49.     }
  50.  
  51.     /** alias setter */
  52.     function setMessage($msg) {
  53.         $this->msg = (string) $msg;
  54.     }
  55.     
  56.     /** setter for subject **/
  57.     function setSubject($subject) {
  58.         $this->subject = (string) $subject;    
  59.     }
  60.  
  61.     /** setter for recipient **/
  62.     function setRecipient($recipient) {
  63.         $this->recipient = (string) $recipient;
  64.     }
  65.  
  66.     /** alias for recipient **/
  67.     function setTo($recipient) {
  68.         $this->recipient = (string) $recipient;
  69.     }
  70.         
  71.     /** Supporting the <mail>Message</mail> syntax. */
  72.     function addText($msg)
  73.     {
  74.         $this->msg = (string) $msg;
  75.     }
  76. }
  77.  
  78.