-
Password script.
I have this script which sends forgotten password to your email. But it sends it from "[email protected]". How can I change it so that it sends from the email I want it to?
PHP Code:
<?PHP
ob_start();
include('configuration.php');
/*
Forgot Password script
*/
if ($_POST['Submit'])
{
$Username = htmlspecialchars($_POST['username']);
if (empty($Username))
{
die("No username was given!");
}
$Search_Query = "SELECT `email` FROM `sexy` WHERE `username` = '$Username'";
$Search_User = mysql_query($Search_Query) or die(mysql_error());
if (mysql_num_rows($Search_User) == 0)
{
die("Invalid username");
}
$DB_Results = mysql_fetch_array($Search_User);
$Email = $DB_Results['email'];
$New_Password = str_shuffle('D4gh7g55CdoP');
usleep(600000);
//Replace "$Email" with your email address. Explanation: mail("RECEIVER EMAIL", "MESSAGE", "YOUR EMAIL")
mail(me@me.com, 'Password Recovery', 'My Message.
Your new password is '.$New_Password. '', '[email protected]');
$New_Password = md5($New_Password);
$Update_Password_Query = "UPDATE `sexy` SET `password` = '$New_Password' WHERE `email` = '$Email'";
$Update_Password = mysql_query($Update_Password_Query) or die(mysql_error());
die("Password Send");
} else {
?>
-
What do i need to do with MySQL?
-
Post configuration.php please.
-
PHP Code:
$from = "myemailaddress.this.com";
mail("[email protected]", "Password Recovery", "My Message.
Your new password is '.$New_Password. '", "$from");
Your sending the from bit as an additional header.
-
Hmm I changed it now its not sending the email but I get no error O.o?
-
PHP Code:
mail(me@me.com, 'Password Recovery', 'My Message.
Your new password is '.$New_Password. '', '[email protected]');
To:
PHP Code:
$headers = "From: Me <[email protected]>\n";
$headers .= "Reply-To: me <[email protected]>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
mail('[email protected]', 'Password Recovery', 'My Message.
Your new password is '.$New_Password. '', $headers);
From: http://www.php.net/mail
-
PHP Code:
$from = "From: myemailaddress.this.com\r\n";
mail("[email protected]", "Password Recovery", "My Message.
Your new password is '.$New_Password. '", "$from");
Try that
-
-
Quote:
Originally Posted by
!Lily
Nope =[
What is the matter:
Is it not working?
Or do you want to change something
-
I get no errors but it doesnt send the email with new password.