email - Reply-To header not picking the php variable -
i creating page sends response contact form within mail reply-to
not working (the variable using having value, not added within headers)
here's code:
<?php //$uname=$_request['uname']; if(isset($_request['name'])) { $name=$_request['name']; } if(isset($_request['email'])) { $email=$_request['email']; } if(isset($_request['phone'])) { $phone=$_request['phone']; } if(isset($_request['message'])) { $message=$_request['message']; } // testing if variables have values echo "$name $email $phone $message"; // result: true till here if($name=="" || $email=="" || $phone=="" || $message=="") { header("location:../?inst=invalid"); } else { // ---------------- send mail form ---------------- // send e-mail ... $to="mail@example.com"; // subject $subject="$name contacted via contact form"; // $headers = "from: me <no-reply@example.com>\r\n"; $headers .= 'reply-to:' . $email . "\r\n"; $headers .= "return-path: info@example.com\r\n"; $headers .= "x-mailer: php\n"; $headers .= 'mime-version: 1.0' . "\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; print $message; // send email $sentmail = mail($to,$subject,$message,$headers); //$sentmail = mail($to1,$subject,$message,$header); } // if email succesfully sent if($sentmail){ echo "mail sent."; } else { header("location:../landing/?status=verification-pending"); } ?>
now when checked headers in gmail, value $email doesn't appear in header information, no message received. blank message or may $message not printing same case facing reply-to.
please me little this. in advance.
check have php warnings , notices enabled. when echoing out $name, $email, etc doing redirect using headers after that. if php notices etc aren't turned on, header redirect fail due having echoed something, , won't know had invalid input. part of reason shouldn't echo things out during logic, should store , out put values later.
Comments
Post a Comment