I am utilizing this contact form and when tested the email is not sent. Does anyone know what may be wrong with my coding?
[CODE]
<?php
$from = “[email protected]”;
$from_name = “My Company”;
$subject = “Contact Form”;
$to = $_POST[‘[email protected]’];
// collect data
$body = “”;
foreach($_POST as $key => $val)
{
if($key != ‘captcha’)
$body .= ucfirst($key).”: “.$val.”rn”;
}
// construct MIME PLAIN Email headers
$header = “MIME-Version: 1.0n”;
$header .= “Content-type: text/plain; charset=utf-8n”;
$header .= “From: $from_name <$from>rnReply-To: $from_name <$from>rnReturn-Path: <$from>rn”;
// send email
$mail_sent = mail($to, $subject, $body, $header);
?>
[CODE]
<form method=”post” onsubmit=”return sendContact();” action=”sendContact.php”>
<p>
<label for=”name” id=”lname”>Full name:</label>
<input type=”text” class=”text” name=”name” id=”name” onfocus=”input_focus(‘name’);” onblur=”input_blur(‘name’);” />
</p>
<p>
<label for=”email” id=”lemail”>Email address:</label>
<input type=”text” class=”text” name=”email” id=”email” onfocus=”input_focus(’email’);” onblur=”input_blur(’email’);” />
</p>
<div class=”x”></div>
<p class=”error” id=”email-error”>You must enter your email address.</p>
<p>
<label for=”category” id=”lcategory”>Select One:</label>
<select name=”category” id=”category” onfocus=”input_focus(‘category’);” onblur=”input_blur(‘category’);”>
<option value=”resources”>Customer Service</option>
<option value=”software”>Sales Department</option>
<option value=”hardwae”>Technial Department </option>
<option value=”consulting”>Press Department</option>
</select>
</p>
<p>
<label for=”message” id=”lmessage”>Message:</label>
<textarea name=”message” id=”message” onfocus=”input_focus(‘message’);” onblur=”input_blur(‘message’);”></textarea>
</p>
<div class=”x”></div>
<p class=”error” id=”message-error”>You must enter your message.</p>
<p>
<label for=”captcha” id=”lcaptcha”></label>
<input type=”text” class=”text” name=”captcha” id=”captcha” onfocus=”input_focus(‘captcha’);” onblur=”input_blur(‘captcha’);” />
</p>
<div class=”x”></div>
<p class=”error” id=”captcha-error”>Are you sure about your calculations?</p>
<script type=”text/javascript”>
generate_captcha(‘lcaptcha’);
</script>
<div class=”x”></div>
<input type=”submit” class=”submit” name=”send_contact” value=”Send” />
</form>