I'm new to php and writing a php script to let me know that someone is trying to contact me. Unfortunately I don't know what the problem is. Here is my current code:
<?php
require_once "contact-form-handler2.php";
$from = "xxxx Sender <xxxx@hotmail.com>";
$to = "xxx@live.com Recipient <xxxx@live.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "tls//smtp.live.com";
$port = "587";
$username = "xxxx@hotmail.com";
$password = "xxxx";
$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>");
}
?>
I keep getting the error :
( ! ) Fatal error: Class 'Mail' not found in C:\Users\Nathan\Desktop\Website\Website\mail.php on line 17
Call Stack
# Time Memory Function Location
1 0.0004 678920 {main}( ) ..\mail.php:0
line 17 is " $smtp = Mail::factory('smtp'," I know it has something to to with the variable "Mail," but I can't quite get it running.
Currently, I'm working on my site locally, using Apache (WAMP), but once I get my site finished I will be a hosting company, which will also host my email client, then I will change it from hotmail/live


