Hi,
We have a contact us form on our website, was set up by another company that has since gone bump. We found out the other day that every time someone fills in the form they get an error message as below:
Parse error: syntax error, unexpected T_STRING in /home/by/public_html/includes/components/sendmail.php on line 51
I have had a look at the code but it is just beyond my capabilities, can anyone have a look at the sendmail.php below and let me know what could be wrong?
Many thanks in advance 🙂
<?php
// To email address
$email_to = "me@here.com";
$email_subject = "Website enquiry";
// From email address
$from = "me@here.com";
$from_name = "Website Email Form";
// The message
$subject = "Web Enquiry Form";
$message = "Someone submitted the following information from our online
form.
Name: ".$_POST["title"]. " " .$_POST["name"]. " " .$_POST["surname"]."
Email: ".$_POST["email"]."
Phone: ".$_POST["telephone"]."
Address: ".$_POST["address_1"]." ".$_POST["address_2"]." ".$_POST
["address_3"]." ".$_POST["address_4"]."
Postcode: ".$_POST["postcode"]."
Country: ".$_POST["country"]."
Enquiry: ".$_POST["message"]."
";
$message_html = "<html>
<body>
<table border=0 cellpadding=2 cellspacing=4>
<tr>
<td width=100><b>Name</b></td>
<td width=300>".$_POST["title"]. " " .$_POST["name"]. " "
.$_POST["surname"]."</td>
</tr>
<tr>
<td><b>Email</b></td>
<td>".$_POST["email"]."</td>
</tr>
<tr>
<td><b>Phone</b></td>
<td>".$_POST["telephone"]."</td>
</tr>
<tr valign=top>
<td><b>Address</b></td>
<td>".$_POST["address_1"]."<br />
".$_POST["address_2"]."<br />
".$_POST["address_3"]."<br />
".$_POST["address_4"]."<br />
".$_POST["postcode"]."<br />
".$_POST["country"]."</td>
</tr>
<tr>
<td><b>Enquiry</b></td>
<td>".$_POST["message"]."</td>
</tr>
</table><!--[if IE 6]>
<script type="text/javascript">
DD_belatedPNG.fix('div, h2, a, div div, ul, h1, #logo, img');
</script>
<![endif]-->
</body>
</html>";
/***********************************************/
/* No need to modify anything down here */
/* Note that these are needed to send the mail */
/***********************************************/
// Generate text + html version
$random_hash = md5(date("r", time()));
$mailmessage = "
--PHP-alt-".$random_hash."
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
$message
--PHP-alt-".$random_hash."
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
$message_html
--PHP-alt-".$random_hash."--
";
// Headers
// To send HTML mail, the Content-type header must be set
$headers = "From: ".$from_name." <".$from.">" . "\r\n";
$headers .= "Reply-To: ".$from_name." <".$from.">" . "\r\n";
$headers .= "Date: ".date("r") . "\r\n";
// Additional headers
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"PHP-alt-" .
$random_hash . "\"\r\n";
$headers .= "Message-Id: <" . md5(uniqid(microtime())) . "@" . $_SERVER
["SERVER_NAME"] . ">\r\n";
header( "Location: ../../contact/thanks/index.php" );
// Send the mail
mail($email, $subject, $mailmessage, $headers);
echo "Email sent.";
?>