this is a forgot password page and this email script will not send , please help
PHP Code:
<?php
$emailcut = substr($email, 0, 4); // Takes first four characters from the user email address
$randNum = rand();
$tempPass = "$emailcut$randNum";
$hashTempPass = md5($tempPass);
@mysql_query("UPDATE myMembers SET password='$hashTempPass' where email='$email'") or die("cannot set your new password");
include('Mail.php');
include('Mail/mime.php');
// Constructing the email
$sender = "Social network"; // Your email address
$recipient = "$email"; // The Recipients name and email address
$subject = "Reset Your Password"; // Subject for the email
$text = 'This is a text message.'; // Text version of the email
$html = "<html><body><div align=center><br>----------------------------- New Login Password --------------------------------<br><br><br>
Your New Password for our site is: <font color=\"#006600\"><u>$tempPass</u></font><br><br />
</div></body></html>"; // HTML version of the email
$crlf = "\n";
$headers = array(
'From' => $sender,
'Return-Path' => $sender,
'Subject' => $subject
);
// Creating the Mime message
$mime = new Mail_mime($crlf);
// Setting the body of the email
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
// Add an attachment
// Set body and headers ready for base mail class
$body = $mime->get();
$headers = $mime->headers($headers);
// Sending the email using smtp
$mail =& Mail::factory("smtp", $smtp_params);
$result = $mail->send($recipient, $headers, $body);
if (PEAR::isError($mail)) {
$outputForUser = '<font color="#FF0000">Password Not Sent.<br /><br />
Please Contact Us...</font>';
} else {
$outputForUser = "<font color=\"#006600\"><strong>Your New Login password has been emailed to you.</strong></font>";
}
}
} else {
$outputForUser = 'Enter your email address into the field below.';