I have a contact form which I'm trying to test out on our new server and although I can successfully complete it and enter the CAPTCHA successfully, it just isn't sending. Is this something to do with my PHP settings? I have GD enabled on my server.
Personal Details
------------------------------------
Name:
$name
Email:
$email
Phone:
$phone
Location:
$area
Business Details
-----------------------------------
Subject:
$sub
Message:
$message
-----------------------------------
Date of Enquiry: ".$date." at ".$time."
IP Number: ".$IPnumber."
";
$validstring = '^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3}))$';
if (!eregi($validstring,$email)&&$email) {
$emailcorrect = 0;
}
else {
$emailcorrect = 1;
}
if($valid == true) {
echo "";
} else {
echo "<center>Sorry, the code you entered was invalid. Please reload the image and retry. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>";
}
if($email&&$subject&&$name&&$message&&$emailcorrect&&$valid) {
if(mail($youremail, $subject, $msg, "From: Christopher James Website Enquiry<$email>")) {
echo " <table width='100%' border='0' class='tickyellowbox' cellpadding='10' cellspacing='0'>
<tr>
<td width='10%'><img src='images/tick.gif' alt='tick' width='39' height='33' /></td>
<td width='90%'><span class='style4'>Your email was sent to our Office. Thank you $name, for your enquiry.<br />You will be contacted shortly regarding your email.</span></td>
</tr>
</table></ br>";
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$autoreply="Thank you for your message $name. You sent the following:
below\n\n$message\n\nThis is an automated reply.";
$subject="Thank you for your submission $name!";
mail($email, $subject, $autoreply, "From: Christopher James Wood Flooring and Interiors - Email Confirmation<$email>");
}
}
//
if(!$email||!$subject||!$name||!$message) {
echo " <table width='100%' border='0' class='tickredbox' cellpadding='10' cellspacing='0'>
<tr>
<td width='10%'><img src='images/cross.gif' alt='tick' width='39' height='33' /></td>
<td width='90%'><span class='style3'>Sorry, $name, <br />your e-mail was not sent<br /> you have forgotten to fill in a detail.</span></td>
</tr>
</table> ";
}
if (!$emailcorrect) {
echo " <table width='100%' border='0' class='tickredbox' cellpadding='10' cellspacing='0'>
<tr>
<td width='10%'><img src='images/cross.gif' alt='tick' width='39' height='33' /></td>
<td width='90%'><span class='style3'>Sorry, $name, <br />your e-mail address is not valid.</span></td>
</tr>
</table> ";
}
?>
It completes the process successfully, but no email is sent. Any ideas?
Just to add - this was working up until a couple of weeks ago - do you think it could be a server update that has messed up my PHP? It's a dedicated server so I wouldn't have expected anything like this to be updated without me knowing about it.