<?php
error_reporting(E_NOTICE);
function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
if($name!='' && $email!='' && valid_email($email)==TRUE )
{
$to = $receiver;
$headers = 'From: '.$email.''. "\r\n" .
'Reply-To: '.$email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "Enquiry Form";
$messagebody = "<table width=\"800\" align=\"left\" border=\"0\" style=\"font-family:Verdana,Geneva,serif;font-size:12px; border-collapse:collapse\" cellspacing=\"10\" cellpadding=\"5\">
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Title</td><td>$title</td></tr>
<tr><td style=\"font-weight:700\">Firstname</td><td>$fname</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Lastname</td><td>$lname</td></tr>
<tr><td style=\"font-weight:700\">Email Address</td><td>$email</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Reason for Selling</td><td>$reason</td></tr>
<tr><td style=\"font-weight:700\">Home</td><td>$home</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Work</td><td>$work</td></tr>
<tr><td style=\"font-weight:700\">Mobile</td><td>$mobile</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">House/Flat number</td><td>$flt_no</td></tr>
<tr><td style=\"font-weight:700\">Street</td><td>$strt</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">District</td><td>$dstrct</td></tr>
<tr><td style=\"font-weight:700\">Town</td><td>$town</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Country</td><td>$country</td></tr>
<tr><td style=\"font-weight:700\">Post Code</td><td>$pcode</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Type of Property</td><td>$propertytype</td></tr>
<tr><td style=\"font-weight:700\">Number of Bedrooms</td><td>$bedno</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Number of Bathrooms</td><td>$bathno</td></tr>
<tr><td style=\"font-weight:700\">Number of Toilet</td><td>$toilet</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Number of reception rooms</td><td>$room</td></tr>
<tr><td style=\"font-weight:700\">Garage</td><td>$garage</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Is there a garden?</td><td>$garden</td></tr>
<tr><td style=\"font-weight:700\">Are there any nice or unique features of the property that may be of interest to the cash buyer? For example, fireplace, wood flooring, end of terrace, etc ?</td><td>$nice_features</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">What is the general condition of your property?</td><td>$gen_condition</td></tr>
<tr><td style=\"font-weight:700\">Is there anything you would like to add regarding the general condition of your property?</td><td>$add_gen_cond</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">When was your property built approximately?</td><td>$prop_built</td></tr>
<tr><td style=\"font-weight:700\">Does your property have central heating?</td><td>$cent_heat</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Does your property have double glazing?</td><td>$dob_glazing</td></tr>
<tr><td style=\"font-weight:700\">What is the structure of your property?</td><td>$prop_stuc</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Is your property ex-council or housing association?</td><td>$ex_council</td></tr>
<tr><td style=\"font-weight:700\">Is your property in a block?</td><td>$prop_block</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">If it is in a block, are more than 50% of the flats privately owned</td><td>$block_flats</td></tr>
<tr><td style=\"font-weight:700\">If it is in a block, how many floors are there?</td><td>$block_floors</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">If it is in a block, on which floor is your property situated?</td><td>$block_situated</td></tr>
<tr><td style=\"font-weight:700\">Is your property above shops that sell foods and drinks (e.g. restaurants, takeaways, etc)?</td><td>$property_sells</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Is the property freehold or leasehold?</td><td>$free_lease</td></tr>
<tr><td style=\"font-weight:700\">If leasehold, how many years are there left?</td><td>$leasehold</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Have you done any work on the property? If yes, please give details, e.g. new bathroom, kitchen, etc</td><td>$property_work</td></tr>
<tr><td style=\"font-weight:700\">Estimated value of property</td><td>$est_value</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Please explain briefly how you arrived at this figure :</td><td>$exp_figure</td></tr>
<tr><td style=\"font-weight:700\">Outstanding Mortgage Balance</td><td>$out_bal</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">What is the monthly achievable rental income for your property, if known? �</td><td>$rent_achieve_income</td></tr>
<tr><td style=\"font-weight:700\">What�s the reason for needing a quick sale?</td><td>$reason_sale</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">How soon do you need to complete?</td><td>$need_cmp</td></tr>
<tr><td style=\"font-weight:700\">Do you wish to rent back the property?</td><td>$wish_rent</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">If yes, how long do you wish to rent it back for?</td><td>$rent_back</td></tr>
<tr><td style=\"font-weight:700\">Any loans secured on the property not already included in the mortgage balance?</td><td>$mort_bal</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">If yes, how much?</td><td>$yes_how_much</td></tr>
<tr><td style=\"font-weight:700\">Is your property currently on the market?</td><td>$prop_market</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">If yes, how much is it on the market for?</td><td>$market_price</td></tr>
<tr><td style=\"font-weight:700\">If yes, how long has its been on the market for?</td><td>$market_long</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">Has the price ever been reduced?</td><td>$reduce</td></tr>
<tr><td style=\"font-weight:700\">If so, when was it reduced?</td><td>$when_reduced</td></tr>
<tr style=\"backgroun开发者_StackOverflowd-color:#1376c9;\"><td style=\"font-weight:700\">Please provide further information you feel may be relevant for the cash buyer:</td><td>$fur_info</td></tr>
<tr><td style=\"font-weight:700\">Are you able to confirm this?</td><td>$bttn1</td></tr>
<tr style=\"background-color:#1376c9;\"><td style=\"font-weight:700\">more offers:</td><td>$bttn2</td></tr>
</table>";
$message="<html>
<head>
<title></title>
</head>
<body ><center>
".stripslashes($messagebody)."
</center>
</body>
</html>
";
if(mail($to, $subject, $message, $headers))
{
//echo 1; //SUCCESS
("Location:http://ukquickpropertybuyers.co.uk/enquiry-form/");
}
else {
// echo 2; //FAILURE - server failure
("http://ukquickpropertybuyers.co.uk/enquiry-form/");
}
}
else {
echo 3; //FAILURE - not valid email
header("http://ukquickpropertybuyers.co.uk/enquiry-form/");
}
?>
You need to tell php to send the email as an HTML email.
Give this code a whirl....
// Always set content-type when sending HTML email
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
精彩评论