lesser-equity

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


Register


Reply
 
Thread Tools
  #1  
Old 30th Mar 2008, 12:21
Member Group
 
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]
<?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);
}
}

?>
[/php]

Please help someone it will be much appreciated. going kind of mad.

Thanks very much
  #2  
Old 31st Mar 2008, 17:31
Donor Group
 
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)
Reply

Register
Thread Tools




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

Copyright ©2006 - 2009 Computer Juice.

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