I am having some trouble with using the send mail functionality of pear with wamp. I went through with the steps in this link : (http://pear.php.net/manual/en/installation.checking.php) to check if my pear was installed correctly, and it seems like I have it right.
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
The code above returns bool(true)
. So I am assuming that my paths are set right.
But for the code below I am getting an error.
<?php
include 'Mail.php';
include 'Mail/mime.php' ;
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = 'test.xls';
$crlf = "\n";
$hdrs = array(
'From' => 'myemail@gmail.com',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime(array('eol' => $crlf));
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('myemail2@gmail.com', $hdrs, $body);
?>
Error is on this line : $mail =& Mail::factory('mail');
. Fatal error: Class 'Mail' not found
Also, I installed pear Mail with this command : pear install Mail Mail_mime
I would appreciate any help.
Thanks,