اخوانى احتاج مساعدة فى تعديل سكريبت PHP
كنت قد قمت بعمل سكريبت PHP مرتبط بصفحة contact لموقع و كان يعمل جيدا لارسال رسائل من الزوار الى الايميل المحدد فى الاسكريبت و لكن قام سيرفر الاستضافة بعمل تطوير لوسائل الحماية لديه و طلب منى تعديل الاسكريبت ليعمل على SMTP authentication وقد قمت بالتعديل لكنه يعطنى خطأ باستمرار . ارجو مساعدة فى تصحيح الخطأ بالاسكريبت :
[[LEFT]LEFT][LEFT][CENTER]
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "omario282001*yahoo.com,info*971adv.com,omar*971ad v.com,gemo_omar*yahoo.com";
//$email_subject = "Your email subject line";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['full_name']) ||
!isset($_POST['subject']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$full_name = $_POST['full_name']; // required
$subject = $_POST['subject']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
/*Sender's information */
$smtpinfo["host"] = 'localhost'; // server hostname of mail exchanger
$smtpinfo["port"] = '25';
$smtpinfo["auth"] = true;
$smtpinfo["username"] = 'info*971adv.com'; //sender email address as a user in SMTP authentication
$smtpinfo["password"] = '123456'; // password for test123*domain.com
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+*[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/ ";
if(!preg_match($string_exp,$full_name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$subject)) {
$error_message .= 'The Subject you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Name: ".clean_string($full_name)."\n";
$email_message .= "Subject: ".clean_string($subject)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'SUBJECT: '.$subject."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory('smtp', $smtpinfo);
/* Ok send mail */
$mail_object->send($email_to, $subject, $email_message, $headers);
if (PEAR::isError($mail_object)) {
echo("<p>" . $mail_object->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
header("Location: http://www.971adv.com/contact2.html");
}
?>
و رسالة الخطأ كالتالى:-
[COLOR="Red"]
Fatal error: Class 'Mail' not found in /home/adv/public_html/send_form_email2.php on line 79