tleisher Posted September 2, 2006 Share Posted September 2, 2006 Why would this code print the message twice in the mail:[code=php:0]$from = "forgotten@".$hostname; $to = $lost_email; $subject = "Password Reminder From ".$hostname; $headers = "MIME-Version: 1.0\r\n". "Content-type: text/html; charset=iso-8859-1\r\n". "From: \"Password Reminder\" <".$from.">\r\n". "To: \"User\" <".$to.">\r\n". # Mail message $message = " Someone (hopefully you) requested that your password be reset, if you received this in error please e-mail your admin at " . $author_email . "<br /><br />You're new password is: " . $n_pass; $response = mail($to, $subject, $message, $headers); [/code]Returns this in the email:[quote] Someone (hopefully you) requested that your password be reset, if you received this in error please e-mail your admin at *******You're new password is: ******* Someone (hopefully you) requested that your password be reset, if you received this in error please e-mail your admin at *******You're new password is: *******[/quote] Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/ Share on other sites More sharing options...
tomfmason Posted September 2, 2006 Share Posted September 2, 2006 ?? That is wierd. I have never had that happen before. I doubt this will fix it but try placeing the $message before the headers. Good Luck,Tom Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/#findComment-84573 Share on other sites More sharing options...
redarrow Posted September 2, 2006 Share Posted September 2, 2006 i think that not all the code as i suspect you got the message around a for loop i guess? Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/#findComment-84575 Share on other sites More sharing options...
w32 Posted September 2, 2006 Share Posted September 2, 2006 yup it must be sumething else, just adapted your code to test, and couldn't reproduce the error..Maybe showing the complete script would help. Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/#findComment-84576 Share on other sites More sharing options...
tleisher Posted September 2, 2006 Author Share Posted September 2, 2006 That was the whole mail() part of it, anything involving it anyway.The problem was that I had $to, and a To: variable in my header, so it had it twice.. for some reason that made it angry and when I removed the To: in $headers, it works. Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/#findComment-84635 Share on other sites More sharing options...
redarrow Posted September 2, 2006 Share Posted September 2, 2006 i love the reply but well done good luck. Link to comment https://forums.phpfreaks.com/topic/19478-mail-acting-up/#findComment-84637 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.