lesser-equity

Computer Juice Magazine
Go Back   Computer Juice > Computer Software > Web Design, Hosting & SEO



Reply
 
Thread Tools
  #1  
Old 30th Mar 2008, 12:21
Member Group
 
Posts: 54
Default Pear mail

Hello all im having a problem with Pear mail.php

im getting this error message

Fatal error: Class 'Mail' not found in \PEAR\mail.php on line 26

here is my code

PHP Code:
<?php                            
// reference the Mail PEAR library
require_once 'Mail.php';
// Main class, used to obtain order information,
// run pipeline sections, audit orders, etc.
class OrderProcessor             
{                                
  public 
$mOrderId;              
  public 
$mOrderStatus;          
  public 
$mConnection;           
  public 
$mConfiguration;        
  public 
$mContinueNow;          
  private 
$mCurrentCustomer;     
  private 
$mCurrentOrderDetails
  private 
$mOrderManager;        
  private 
$mReference;           
  private 
$mAuthCode;            
  
// constructor creates DoOrderManager instance
  
function __construct()         
  {                              
    
$this->mOrderManager = new DoOrderManager();
  }                              
  
// Process is called from checkout.php and orders_admin.php to process an 
  // order; the first parameter is the ID of the order, and the second 
  // parameter is an OrderProcessorConfiguration instance. 
  
public function Process($newOrderId$newConfiguration)
  {                                            
    
// set order ID                            
    
$this->mOrderId $newOrderId;             
    
// configure processor                     
    
$this->mConfiguration $newConfiguration
    
$this->mContinueNow true;                
    
// log start of execution                  
    
$this->AddAudit("Order Processor started."10000);
    
// obtain status of order                  
    
$this->mOrderStatus $this->mOrderManager->GetOrderStatus($this->mOrderId);
    
// process pipeline section                
    
try                                        
    {                                          
       while (
$this->mContinueNow)             
       {                                       
         
$this->mContinueNow false;          
         
$cps $this->GetCurrentPipelineSection();
         
$cps->Process($this);                 
       }                                       
    }                                          
    catch(
Exception $e)                        
    {                                          
       
trigger_error('Exception "' $e->getMessage() . '" on ' 
                       
$e->getFile() . " line " $e->getLine());
       
$this->MailAdmin("Order Processing error ocured."$e->getMessage());
       
$this->AddAudit("Order Processing error ocured."10002);
       throw new 
Exception("processor error"); 
    }                                          
    
$this->AddAudit("Order Processor finished."10001);
  }                                            
  
// gets an object instance representing the current pipeline section
  
private function GetCurrentPipelineSection()
  {       
    switch (
$this->mOrderStatus
    {     
       case 
0:
         
$this->mCurrentPipelineSection = new PsInitialNotification(); break;
       case 
1:
         
$this->mCurrentPipelineSection = new PsCheckFunds(); break;
       case 
2:
         
$this->mCurrentPipelineSection = new PsCheckStock(); break;
       case 
3:
         
$this->mCurrentPipelineSection = new PsStockOk(); break;
       case 
4:                                        
         
$this->mCurrentPipelineSection = new PsTakePayment(); break;
       case 
5:                                        
         
$this->mCurrentPipelineSection = new PsShipGoods(); break;
       case 
6:                                        
         
$this->mCurrentPipelineSection = new PsShipOK(); break;
       case 
7:                                        
         
$this->mCurrentPipelineSection = new PsFinalNotification(); break;
       case 
8:                                        
         throw new 
Exception("Order has already been completed."); break;
       default:                                       
         throw new 
Exception("Unknown pipeline section requested.");
    }                                                 
  }                                                       
  
// sends email                               
  
public function Mail($params$to$headers$message)
  {                                            
    
// Create the mail object using the Mail::factory method
    
$mail_object Mail::factory('smtp'$params);
    
// Test the mail object is valid           
    
if (PEAR::isError($mail_object))           
       throw new 
Exception($mail_object->getMessage());
    
// sends email                             
    
$result $mail_object->send($to$headers$message);
    
// Test if mail was sent successfully      
    
if (PEAR::isError($result))  
       throw new 
Exception("Unable to send e-mail to $to. " .
                             
$result->getMessage());
  }                              
  
// builds email message        
  
public function MailAdmin($subject$message)
  {                              
    
// usually you are not allowed to set the 'From' header
    
$headers['From'] = $this->mConfiguration->mOrderProcessorEmail;
    
$headers['Subject'] = $subject;
    
$headers['To'] = $this->mConfiguration->mAdminEmail;
    
$this->Mail($this->mConfiguration->mOrderProcessorEmailParams
                  
$this->mConfiguration->mAdminEmail
                  
$headers,      
                  
$message);     
  }                              
  
// gets the customer that made the order
  
public function GetCurrentCustomer()
  {                              
    if (empty(
$this->mCurrentCustomer))
    {                            
       
$this->mCurrentCustomer = new 
        
Customer($this->mOrderManager->GetCustomerByOrderId($this->mOrderId));
       if (empty(
$this->mCurrentCustomer))
         throw new 
Exception($this->mOrderId " order doesn't have a
customer"
);                      
    }                            
    return 
$this->mCurrentCustomer;
  }                              
  
// gets the details of the current order
  
public function GetCurrentOrderDetails()
  {                              
    if (empty(
$this->mCurrentOrderDetails))
    {                            
       
$this->mCurrentOrderDetails = new 
         
OrderDetails($this->mOrderManager->GetOrderDetails($this->mOrderId));
       if (empty(
$this->mCurrentOrderDetails))
         throw new 
Exception($this->mOrderId 
                                
" doesn't have order details entry");
    }                            
    return 
$this->mCurrentOrderDetails;
  }                              
  
// adds audit message          
  
public function AddAudit($message$messageNumber)
  {                              
    
$this->mOrderManager->AddAudit($this->mOrderId$message$messageNumber);
  }                              
  
// updates order status                      
  
public function UpdateOrderStatus($newStatus)
  {                                            
    
$this->mOrderManager->UpdateOrderStatus($this->mOrderId$newStatus);
    
$this->mOrderStatus $newStatus;          
  }           
    
// set order's authorization code and reference code           
  
public function SetOrderAuthCodeAndReference($newAuthCode$newReference)
  {                                                              
    
$this->mOrderManager->SetOrderAuthCodeAndReference($this->mOrderId
                                                              
$newAuthCode
                                                              
$newReference);
    
$this->mAuthCode $newAuthCode;                             
    
$this->mReference $newReference;                           
  }     
                   
  
// gets order authorization code and reference code            
  
private function GetOrderAuthCodeAndReference()                
   {                                                              
     
$result $this->mOrderManager->GetOrderAuthCodeAndReference(
                                                                 
$this->mOrderId);
     if (empty(
$result)) throw Exception($this->mOrderId." doesn't exist");
     
$this->mAuthCode $result['auth_code'];                     
     
$this->mReference $result['reference'];                    
   }                                                              
   
// gets order authorization code                               
  
public function GetAuthCode()
  {                      
     if (empty(
$this->mAuthCode)) $this->GetOrderAuthCodeAndReference();
     return 
$this->mAuthCode
  }                      
  
// gets order reference code
  
public function GetReference()
  {                      
     if (empty(
$this->mReference)) $this->GetOrderAuthCodeAndReference();
     return 
$this->mReference
  }     
    
// set order's ship date
  
public function SetDateShipped()
  {                     
    
$this->mOrderManager->SetDateShipped($this->mOrderId);
  }                          
}                    
                          
?>
Please help someone it will be much appreciated. going kind of mad.

Thanks very much

  #2  
Old 31st Mar 2008, 17:31
Donor Group
 
Skill Level: Beginner
Posts: 722
Default Pear mail

Did this get resolved?

http://www.geeklog.net/forum/viewtop...howtopic=75900 discusses it. I've not used any Pear modules under Windows so trying it is your best way forward.
__________________

My System: Tim

Processor(s):
Athlon 64 3500+
Motherboard:
Asus A8N-VM CSM
RAM Memory:
Corsair PC3200 CL2 DDR-400 2GB
Graphics Card(s):
nVidia Geforce 6600 512MB
Sound Card:
Cherry RS 6000 M keyboard
Hard Drive(s):
Barracuda.7+ 2x200GB 58MB/s sustain
Optical Drive(s):
Samsung DVD-ROM TS-H352
Case / PSU:
Thermaltake Soprano
Cooling:
Stock
Network / Internet:
Telewest 2x20Mb/sec
Monitor(s):
SXGA flat panel
Operating System(s):
Slackware (2.6.27.7) (Fluxbox)

Please support this forum, donate towards our running costs.
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using google mail app on phone HistoryGirl Laptops, Mobiles & PDAs 2 25th Jul 2008 02:36
Mail in rebates Gazmondo General Hardware Chat 6 26th Feb 2008 16:01
Mail Exchange Server help! StephenPollock Email, VoIP & IM Discussion 12 21st Jan 2008 11:43
Mail prob' liamfi Email, VoIP & IM Discussion 3 1st Jan 2008 08:44
Outlook spooling mail? greensleeves54 Email, VoIP & IM Discussion 4 11th Oct 2007 17:14

Tags
mail, pear

Bookmarks
Thread Tools



Arabic Bulgarian Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Finnish French German Greek Hebrew Hungarian Italian Japanese Korean Norwegian Polish Portuguese Romanian Russian Serbian Slovak Spanish Swedish Thai Turkish

Copyright ©2006 - 2009 Computer Juice.

Powered by vBulletin® Copyright ©2000 - 2009 Jelsoft Enterprises Ltd. SEO by vBSEO ©2009, Crawlability, Inc.