Go Back   Computer Juice > Computer Software > Web Design & Programming
Register iSpy Downloads New Posts Donate Unanswered Posts Member List Search

Computer Juice raffle - Win PC hardware of your choice worth £500 / €680 / $1000 - Enter HERE!


Computer Juice - Forums - Pear mail


Reply
 
Thread Tools
  #1  
Old 30-03-2008, 07:21 PM
MySlowQuietLife's Avatar
CJ Member
 
MySlowQuietLife is offline
 
Join Date: Feb 2008
Last Online: 30-03-2008 08:26 PM
Posts: 54
iTrader: (0)
MySlowQuietLife is on a distinguished road
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
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote
  #2  
Old 01-04-2008, 12:31 AM
spot's Avatar
spot  Wales
CJ Donator
Intel Nvidia
spot is offline
 
Join Date: Feb 2008
Last Online: 29-06-2008 04:34 PM
Posts: 525
iTrader: (0)
spot is on a distinguished roadspot is on a distinguished road
Default

Pear mail


Did this get resolved?

<Link hidden. Register for free to see this link!> discusses it. I've not used any Pear modules under Windows so trying it is your best way forward.
__________________

My System: Tim

CPU(s):
Athlon 64 3500+
Motherboard:
Asus A8N-VM CSM
RAM:
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 sustained
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.24.3) (Fluxbox) (bash)

Want your system info in your signature?
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote

Please support this forum, donate towards our running costs.


Reply


Thread Tools

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Windows Mail dfr200764 Email, VoIP & IM Discussion 19 18-03-2008 08:49 PM
Mail in rebates Gazmondo General Hardware Chat 6 26-02-2008 11:01 PM
Mail prob' liamfi Email, VoIP & IM Discussion 3 01-01-2008 03:44 PM
yahoo mail problem dfr200764 Email, VoIP & IM Discussion 2 08-12-2007 07:15 PM
Outlook spooling mail? greensleeves54 Email, VoIP & IM Discussion 4 12-10-2007 12:14 AM



Copyright ©2006 - 2008 Computer Juice - Forums - Free PC Help, Support and Repairs.

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