Sending Mail via PEAR
-
Hi,
I just developed a custom theme and installed WordPress at the root of my site.
Before this I had a collection of static html pages. One of the features I had was a jQuery plugin which opens a ‘contact me’ form to let visitors send me an email directly from my site. It used a simple PHP file that used the PEAR extension to send the email to my hotmail. It was simple but it worked well and I got the emails.
After installing wordpress and my custom theme however the emailer no longer works. Even though I have the same PHP file, in the same locations on my server, the emails are not being sent to me.
This is the PHP file:
<?php require_once "Mail.php"; $to = "my_email_address"; $from = $_POST["from"]; $subject = $_POST["subject"]; $body = $_POST["message"] . "\n\n" . $_POST["pageURL"]; $host = "localhost"; $username = "my_correct_verified_username"; $password = "my_correct_verified_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo($mail->getMessage()); } else { echo("Message successfully sent!"); } ?>
Any idea why this would stop working after intalling WP? Is it to do with the script not being able to find Mail.php in the require_once line?
- The topic ‘Sending Mail via PEAR’ is closed to new replies.