Fatal error: Uncaught exception 'Zend_Exception' with message 'File "Mail.php" does not exist or class "Mail" was not found in the file' in C:\xampp\htdocs\fyp\plugin\Zend\Loader.php:99
Stack trace: #0 C:\xampp\htdocs\fyp\report\bounce.php(9): Zend_Loader::loadClass('Mail') #1 {main} thrown in C:\xampp\htdocs\fyp\plugin\Zend\Loader.php on line 99
The structure of my folder is:
root/report/call.php
root/pluign/Zend/Loader/Autoloader.php
The Zend framework seems have some problem in locating files. How to fix that? thank you
call.php:
<?
set_include_path($_SERVER['DOCUMENT_ROOT'].'/fyp/plugin');
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
//Zend_Loader_Autoloader::getInstance();
//set_include_path('../plugin/ZendFramework-1.11.11-minimal/library/Zend');
Zend_Loader::loadClass('Mail');
$mail = new Zend_Mail_Storage_IMAP(array('host' => 'imap.gmail.com',
'user' => 'admin@gmail.com',
'password' => 'pwd',
'ssl' => 'SSL',
'port' => 993
));
echo $mail->countMessages() . " messages found\n";
foreach ($mail as $message) {
echo "Mail from '{$message->from}': {$message->subject}\n";
}
include("../connection/conn.php");
session_start();
?>
put the Zend Framework in your php.ini include_path. Which is what
include_path='.;C:\xampp\php\PEAR'is pointing to.in your php.ini make your include path look something like
include_path='.;C:\xampp\php\PEAR;C:\path\to\ZendFramework-1.11.11-minimal/library'then your autoloader should work.To address your edit:
The class name is not ‘Mail’.
Zend_Loader::loadClass('Zend_Mail');With ZF 1.x the classname mimics the path to the file. It’s an adhoc namespacing that was done before PHP had namespaces.
so for example
Zend_Mail_Storage_IMAPwould live at/Zend/Mail/Storage/IMAPHope this helps