Jump to content

PHP SendMail not sending HTML properly, text doesn't go onto next line?!


jarv

Recommended Posts

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: info@affordableappliancerepairs.co.uk\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>

Link to comment
Share on other sites

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, webmaster@affordableappliancerepairs.co.uk 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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.