I have a script on my website and its working somewhat? I receive form data but.. the from say "Mail failure - malformed recipient address" on hostgator. I get the subject and message but not the email address from the form. How could I fix this? <form action="send_mail.php" method="post"> <input name="name" type="text" placeholder="Your Name..."> <input name="email_address" type="email" placeholder="Your Email..."> <textarea name="message" placeholder="Your Message..."></textarea> <input type="submit" value="Submit →" class="dropsubmitbtn"> </form> Code (markup): <?php /* This first bit sets the email address that you want the form to be submitted to. You will need to change this value to a valid email address that you can access. */ $webmaster_email = "support@****.com"; /* ENTER EMAIL ADDRESS TO THE LEFT INSIDE THE QUOTES */ /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "index.html"; $error_page = "error.html"; $thankyou_page = "thanks.html"; /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ $name = $_REQUEST['name'] ; $email_address = $_REQUEST['email_address'] ; $comments = $_REQUEST['message'] ; /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_REQUEST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "Message from your Free Lol RP site", $name, $comments, "From: $email_address" ); header( "Location: $thankyou_page" ); } ?> Code (markup):
There is no such thing as [/FONT][FONT=courier new]<input type="email" placeholder="Your email..." />[/FONT][FONT=courier new] Code (markup): What you should have used instead is: <input type="text" value="Your email" /> Code (markup): There are no such properties as "email" and "placeholder" in the W3C HTML standards. I suspect this is the reason for your code failing. Remember that <input type="text" /> is the correct format here.
I changed it to <form action="send_mail.php" method="post"> <input name="name" type="text" placeholder="Your Name..."> <input name="email_address" input type="text" value="Your email" /> <textarea name="message" placeholder="Your Message..."></textarea> <input type="submit" value="Submit →" class="dropsubmitbtn"> </form> Code (markup): and still get the same email with no "from" address