jarv Posted August 18, 2011 Share Posted August 18, 2011 here are my pages below: the text isn't going onto the next line even if I put text on a new line in my email form?! Email form: <form action="send-massemail-script.php" method="post" name="form" onsubmit="return validate()"> <fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns --> <p> <label>Customer Name</label> <select name="name" id="name"> <option value="Please select name">Please select name</option> <?php while($row1 = mysql_fetch_array($result3)) { echo '<option value="'.$row1['id'].'">'.$row1['customer_name'].'</option>'; } ?> </select> </p> <p> <label>Email Title</label> <input class="text-input small-input" type="text" id="small-input" name="EmailTitle" /> </p> <p> <label>Email Body</label> <textarea rows="15" cols="79" name="EmailBody" id="textarea" class="text-input textarea wysiwyg" style="width: 930px; height: 247px;"></textarea> </p> <p> <input class="button" type="submit" value="Send Email" /> </p> </fieldset> <div class="clear"></div><!-- End .clear --> </form> send_mail page: <html> <head> <script> function validate(){ var temp if (document.form.name.value=="Please select name") { alert("Please select a customer.") return false } return true } </script> </head> <body> <?php error_reporting(E_ALL); print_r($_POST); include_once("config.php"); $EmailTitle = mysql_real_escape_string($_POST['EmailTitle']); $EmailBody = mysql_real_escape_string($_POST['EmailBody']); $id = mysql_real_escape_string($_POST['id']); echo $id; $query5 = mysql_query("SELECT * FROM aarbookts_booking_bookings WHERE id = '$id'"); $row5 = mysql_fetch_array($query5); $customer_name = $row5['customer_name']; $EmailBody = filter_input(INPUT_POST, 'EmailBody', FILTER_SANITIZE_STRING); $to = $row5['customer_email']; $from_header = "From: [email protected]\r\n"; $from_header .= "Reply-To: ". strip_tags($to) . "\r\n"; $from_header .= "MIME-Version: 1.0\r\n"; $from_header .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $EmailBody1 = '<html><body>'; $EmailBody1 .= '<p><strong>Dear '.$customer_name.'</strong></p>'; $EmailBody1 .= '<p>'.$EmailBody.'</p>'; $EmailBody1 .= '</body></html>'; $EmailTitle = 'Subject'; if($EmailBody != "") { //send mail - $subject & $contents come from surfer input mail($to, $EmailTitle, $EmailBody1, $from_header); // redirect back to url visitor came from $msg = "Mass email sent"; header("Location: send-mass-email.php?msg=$msg"); } else { print("<HTML><BODY>Error, no comments were submitted!"); print("</BODY></HTML>"); } mysql_close($link); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/245099-php-sendmail-not-sending-html-properly-text-doesnt-go-onto-next-line/ Share on other sites More sharing options...
trq Posted August 18, 2011 Share Posted August 18, 2011 Your sending the email as html. You will need to use <br /> tags to achieve the effect of a new line. See nl2br. Quote Link to comment https://forums.phpfreaks.com/topic/245099-php-sendmail-not-sending-html-properly-text-doesnt-go-onto-next-line/#findComment-1258950 Share on other sites More sharing options...
jarv Posted August 18, 2011 Author Share Posted August 18, 2011 I get the following error when trying to send an email: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/2 Server at www.affordableappliancerepairs.co.uk Port 80 Quote Link to comment https://forums.phpfreaks.com/topic/245099-php-sendmail-not-sending-html-properly-text-doesnt-go-onto-next-line/#findComment-1258966 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.