Ok so my contact form was working fine when I first coded it into my website but now after a few months it has just stopped sending emails through to my address. I'm not sure if this is a problem with the code or with my email? Here is my current mail form...
<form action="contact.php" method="POST" value="form" >
<p>Name:</p><br /><input type="text" name="name" maxlength="25" /><br /><br />
<p>Email address:</p><br /><input type="text" name="email" maxlength="50" /><br /><br />
<p>Message:</p><br /><textarea name="contact_text" rows="6" cols="30" maxlength="1000" ></textarea><br /><br />
<input type="submit" name="submit" />
</form>
<?php
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['contact_text'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$text = $_POST['contact_text'];
if (!empty($name) && !empty($email) && !empty($text)) {
if(strlen($name)>25 || strlen($email)>50 || strlen($text)>1000) {
echo 'Sorry, max length for some field has been exceeded.';
} else {
$to = 'my.email.address@gmail.com';
$subject = 'Contact form submitted';
$body = $text."\n".$name;
$headers = 'From: '.$email;
if (@mail ($to, $subject, $body, $headers)) {
echo '<h5>Thanks for the message, I will be in touch soon.</h5>';
} else {
echo'<h4>Sorry an error occured, please try again later.</h4>';
}
}
}
else {
echo '<h4>All fields are required.</h4>';
}
}
?>