Email Problem

How Can i get this to send code to just send a link to my reset password page. right now it just sends a MINE encoded email and will not let me see the password or a link to the reset password page.

[php]

<? include"master_inc.php"; $email = $_REQUEST['email']; $sql="SELECT * FROM users WHERE email='$email'"; $result=mysql_query($sql); // Mysql_num_row is counting table rows $count=mysql_num_rows($result); //echo "count: $count
"; // If result matches $myusername and $mypassword, table row must be 1 row if($count==0){ die("Sorry but we don't have that email in our system. Please try again. Thank you!"); }else{ //comes from config which pulls from /inc $email_body = $forgot_password_email; } $from = $from_email; $reply_to = $reply_to_email; $return_path = $return_path_email; $to = $email; $subject = $forgot_password_email_subject; //***attaches view tracker to link tracked code*** - CCC $mailbody= "$email_body"; //____________________________Begin Multipart Mail Sender //add From: header $headers = "From:$from\nReply-to:$reply_to\nReturn-path:$return_path\nJobID:$date\n"; //specify MIME version 1.0 $headers .= "MIME-Version: 1.0\n"; //unique boundary $boundary = uniqid("HTMLDEMO8656856"); //tell e-mail client this e-mail contains//alternate versions $headers.="X-Priority: 3\n"; $headers.="Content-Type: multipart/alternative; boundary=\"".$boundary."\"\n"; $headers.="Content-Transfer-Encoding: 7bit\n"; //message to people with clients who don't //understand MIME $headers .= "This is a MIME encoded message.\n\n"; //plain text version of message $headers .= "--$boundary\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\n\n"; $headers .= chunk_split(base64_encode("$mailbody")); //HTML version of message $headers .= "--$boundary\n" . "Content-Type: text/html; charset=ISO-8859-1\n" . "Content-Transfer-Encoding: base64\n\n"; $headers .= chunk_split(base64_encode("$mailbody")); //send message if (mail("$to", "$subject", "$headers")) { echo"An account verification link has been sent to $email. This link will allow you to reset your password

Emails may take up to 10 minutes to arrive. Check your spam folder also and whitelist this site if you find our message there. Thanks!<br
Back to login"; } ?>

[/php]

if any one can help me with this it would be great. i am new to PHP i know how to alter some of it but this has got me stumped

thanks alot

David Harvey

Hello notdaveharvey,
you have to send message body separately instead of concatenating it to headers.
Remove this code
[php]$headers .= chunk_split(base64_encode("$mailbody")); [/php]

use below code
[php]$message = chunk_split(base64_encode("$mailbody")); [/php]

than use below mail function

[php]mail($to, $subject, $message, $headers);[/php]

instead of mail("$to", “$subject”, “$headers”)

Also you can check here
http://php.net/manual/en/function.mail.php

I hope this will helpful for you.
Reply your Feedback
SR

Sponsor our Newsletter | Privacy Policy | Terms of Service