I installed Pear and then the Mail and SMTP components on my server. I then updated my php.ini file to "include_path = ".C:\wamp\bin\php\php5.4.3\pear" since that is where the Mail.php is. For some reason when I run this test script through a web browser I get the following errors.
Warning: require_once(Mail.php): failed to open stream: No such file or directory in C:\wamp\www\email.php on line 3
and:
Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.;C:\php\pear') in C:\wamp\www\email.php on line 3
I'm pretty new to PHP and before last week had never even heard of pear since I normally setup an exchange server. Any help would be appreciated. Below is the test Script.
<?php
require_once "Mail.php";
$from = "Ty Jacobs <FROM_EMAIL>";
$to = "Ty Jacobs <TO_EMAIL>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.bizmail.yahoo.com";
$port = "465";
$username = "MYUSERNAME";
$password = "MYPASSWORD";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
PHP.INI file:
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
include_path=".;C:\wamp\bin\php\php5.4.3\pear"