jacko_162 Posted March 22, 2010 Share Posted March 22, 2010 i have the following forgot password page; <?php session_start(); // Start Session session_register("session"); // This is displayed if all the fields are not filled in $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>Click <a class=\"two\" href=\"javascript:history.go(-1)\">here</a> to go back"; // Convert to simple variables $email = $_POST['email']; if (!isset($_POST['email'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css" /> <meta http-equiv="content-script-type" content="text/javascript" /> <title>Forgoten Password</title> <style type="text/css"> <!-- .style1 {font-style: italic} --> </style> </head> <body id="cloudy"> <div> <div> <form class="table" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <div class="inner-form"> <div class="notification information png_bg"> <a href="#" class="close"><img src="img/cross_grey_small.png" title="Close this notification" alt="close" /></a> <div> Enter your email address below and we will email you a new password! </div> </div> <table cellspacing="0"> <tr> <th><span class="style1"> <span class="style1"> <label for="some1"> </label> </span> <label for="some1"><div align="right"><em><strong>Email:</strong> </em></div> </label> </span></th> <td><input class="txt" type="text" title="Please enter your email address" name="email" size="30"/></td> </tr> <tr> <th></th> <td class="tr proceed"> <div align="center"> <br /> <input type="image" src="img/buttons/submit.png" name="submit" value="Submit" /> </div></td> </tr> </table> </div> </form> <?php } elseif (empty($email)) { echo $empty_fields_message; } else { $email=mysql_real_escape_string($email); $status = "OK"; $msg=""; //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); if (!stristr($email,"@") OR !stristr($email,".")) { $msg="Your email address is not correct<BR>"; $status= "NOTOK";} echo "<br><br>"; if($status=="OK"){ $query="SELECT email,login FROM members WHERE email = '$email'"; $st=mysql_query($query); $recs=mysql_num_rows($st); $row=mysql_fetch_object($st); $em=$row->email;// email is stored to a variable if ($recs == 0) { //Redirect to r1.html page. print "<script language='Javascript'>document.location.replace('forgotenpass_denied.php');</script>"; } function makeRandomPassword() { $salt = "abchefghjkmnpqrstuvwxyz0123456789"; srand((double)microtime()*1000000); $i = 0; while ($i <= 7) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_password = makeRandomPassword(); $password = md5($random_password); $sql = mysql_query("UPDATE members SET passwd='$password' WHERE email='$email'"); $subject = "Your Password Has been reset"; $message = "Hi, we have reset your password. Your New Password is: $random_password http://www.**********.com/login.php Once logged in you can change your password Thanks! Admin This is an automated response, DO NOT REPLY!"; mail($email, $subject, $message, "From: yoursite.com Webmaster<[email protected]>\n X-Mailer: PHP/" . phpversion()); print "<script language='Javascript'>document.location.replace('forgotenpass_sucess.php');</script>"; } else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";} } ?> </div> </div> </body> if i edit the "mail($email, $subject, $message, "From: yoursite.com Webmaster<[email protected]>\n" line to match my site it doesnt send the email? why is this? Link to comment https://forums.phpfreaks.com/topic/196091-if-i-edit-email-it-wont-send/ Share on other sites More sharing options...
slurpee Posted March 22, 2010 Share Posted March 22, 2010 It's hard to tell from your explanation, but I'll try to help. Are you getting an error? What exactly are you changing the example? Are you accidentally removing the "\n" before the X-Mailer header? Link to comment https://forums.phpfreaks.com/topic/196091-if-i-edit-email-it-wont-send/#findComment-1029886 Share on other sites More sharing options...
jacko_162 Posted March 22, 2010 Author Share Posted March 22, 2010 no for some reason if i change: mail($email, $subject, $message, "From: yoursite.com Webmaster<[email protected]>\n to mail($email, $subject, $message, "From: myreeftests.com Webmaster<[email protected]>\n the mail doesnt get sent, but if i leave it at the default it sends but the headers are obviously wrong..? its VERY odd.. Link to comment https://forums.phpfreaks.com/topic/196091-if-i-edit-email-it-wont-send/#findComment-1029912 Share on other sites More sharing options...
jacko_162 Posted March 22, 2010 Author Share Posted March 22, 2010 anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/196091-if-i-edit-email-it-wont-send/#findComment-1030029 Share on other sites More sharing options...
slurpee Posted March 22, 2010 Share Posted March 22, 2010 What happens when you remove the 4th argument completely? Link to comment https://forums.phpfreaks.com/topic/196091-if-i-edit-email-it-wont-send/#findComment-1030030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.