Location: PHPKode > scripts > Email Robot > emailrobot/include/EMail/EMailMessage.php
<?php

//==================================================
// project: EMailRobot
// version: 0.2
// author: ilya nemihin (hide@address.com)
// date: 27-aug-2002
// url: www.nemilya.narod.ru/erobot/
//==================================================

/*

class parser e-mail message

*/

require_once('../include/EMail/EMail.php');

class EMailMessage extends EMail{

var $state;
var $emailData;

function EMailMessage(){
  $this->EMail();

  $this->state = 'NONE';
  $this->emailData = '';
}

  function setData( $emailData ){
    $this->emailData = $emailData;
  }

  function parse(){
    $_arr = explode( "\n", $this->emailData );
    foreach( $_arr as $_line ){
      if ( $this->state == 'READ_BODY' ){
        $this->body .= $_line."\n";
      }elseif( trim( $_line ) == '' ){
        $this->state = 'READ_BODY';
      }else{
        $_arr2 = explode( ':', $_line );
        if ( $_arr2[0] == 'From' ){
          $this->setFrom( $_arr2[1] );
        }elseif ( $_arr2[0] == 'Subject' ){
          $this->setSubject( $_arr2[1] );
        }
      }
    }
  }

}

?>
Return current item: Email Robot