phpnewbz Posted June 28, 2012 Share Posted June 28, 2012 Hello all thanks in advance for any assistance it seems like sendmail doesn't work for anyone the first time around lol. I have tried inserting numerous "\r" and "\n" where they are supposed to go however when the redirect error page is displayed the errors are not listed on a newline. As well the error message for having an invalid email shows on the end of the list on the error page despite the fact that is second on the list of check_input function. TIA much appreciation You will find the php and html code used below. <?php /* Set e-mail recipient */ $myemail = "[email protected]"; /* Check all form inputs using check_input function */ $name = check_input($_POST['name'], "Enter your name \r"); $email = check_input($_POST['email']); $phone = check_input($_POST['phone'], "Please include your telephone number \n"); $message = check_input($_POST['message'], "Write your message \n"); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid \n"); } /* Let's prepare the message for the e-mail */ $message = "Hello! Your contact form has been submitted by: Full name: $name E-mail: $email Telephone: $phone Message: $message End of message "; /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor */ header('Location: thanks.html'); exit(); /* validate function*/ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { echo ($problem); } return $data; } function echo($myError) { ?> <html> <body> <b><?php echo $myError; ?></b><br /> </body> </html> <?php exit(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/264915-sendmail-errors-not-echoed-on-newline/ Share on other sites More sharing options...
Rage Posted June 28, 2012 Share Posted June 28, 2012 You need to set your mail() to use html using headers Quote Link to comment https://forums.phpfreaks.com/topic/264915-sendmail-errors-not-echoed-on-newline/#findComment-1357644 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.