I have a very simple web form where when the user hits submit, it sends ME an email containing all the info the user entered in the form. My problem is that I cannot get it to send the mail. First of all I should mention that I am just an amateur developer, but do know the basics and “enough to get by”. Also I am hosting my site on my Macbook using Xampp. I got the site up and running just fine, but just cannot get this mail form to work.
What I am using to try to send the mail is php/Pear mail. In my research I figured that I needed PEAR because my ISP “mail server” (excuse my terminology probably being wrong there) requires authentication and the standard php Mail() function does not work with “servers” that require authentication. NOW, I also have a PC with Xampp installed for testing and such, and if I host the same .php file that sends the mail on my PC it works just fine… Well, I should revise that as to it sends the mail, but also displays a dozen or so errors on the page, which I can suppress by changing an error setting in the php.ini file. But when I host the .php file on my Mac’s Xampp server it does NOT send the mail and I get the following error message:
[B]Deprecated:[B]/Applications/XAMPP/xamppfiles/lib/php/pear/Mail.php
Unable to find class for driver smtp
[B]Fatal error:[B]/Library/Webserver/Documents/mailform.php [B]53
I have tried to reinstall and restart Xampp,and installed the latest version of PEAR mail, but still no luck. The code I have to send the mail is:
[CODE]
require_once “Mail.php”;
$from = “Joe <[email protected]>”;
$to = “Joe <[email protected]>”;
$subject = “Someone just entered information on your web form”;
$host = “outgoing.verizon.net”;
$username = “username”;
$password = “Password”;
$body = “Form Data:
Name: ” .$_POST[‘Name’].”
City: “.$_POST[‘City’].”
State: “.$_POST[‘State’].”
Email: “.$_POST[’email’].”
Comments: “.$_POST[‘Comments’];
$headers = array (‘From’ => $from,
‘To’ => $to,
‘Subject’ => $subject);
$smtp = Mail::factory(‘smtp’,
array (‘host’ => $host,
‘auth’ => true,
‘username’ => $username,
‘password’ => $password));
$mail = $smtp->send($from, $headers, $body);
if (PEAR::isError($mail)) {
echo(“<p>” . $mail->getMessage() . “</p>”);
} else {
echo(“<p>Message successfully sent!</p>”);
}
Any suggestions to get this working on my Mac too???