We have finally got a PHP Mail() form working after changing hosts, well I say working.
I've filled out the form to test it with my own email and on submission it successfully sends me a copy, but doesn't sent the business the original email submission. I've included the relevant code below can anyone tell what I'm missing please?
- Code: Select all
$myFile = "log.txt";
$log = 'Availability Check ============================'."\r\n".'Name: '.$name."\r\n".'Email: '.$email."\r\n".'Phone: '.$phone."\r\n".'Number of Cats: '.$cats."\r\n".'Arrival Date: '.$Adate."\r\n".'Collection Date: '.$Ddate."\r\n".'Days: '.$fullDays."\r\n".'Message:'."\r\n".$message."\r\n".'Heard About Us From: '.$hearabout."\r\n".'';
$log = str_replace('&','&',$log);
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "$log\n";
fwrite($fh, $stringData);
fclose($fh);
$to = 'cats@cats.co.uk';
//$to = 'john@petadmin.com';
$subject = 'Enquiry from: '.$name;
$message = 'Availability Check ============================'."\r\n".'Name: '.$name."\r\n".'Email: '.$email."\r\n".'Phone: '.$phone."\r\n".'Number of Cats: '.$cats."\r\n".'Arrival Date: '.$Adate."\r\n".'Collection Date: '.$Ddate."\r\n".'Days: '.$fullDays."\r\n".'Message:'."\r\n".$message."\r\n".'Heard About Us From: '.$hearabout."\r\n".'';
$message = str_replace('&','&',$message);
$headers = 'From: donotreply.cats@petadmin.com' . "\r\n" .
'Reply-To: '.$email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
$Usermessage = 'Thank you for checking availability with cats; the information below has been sent to us. We will contact you to discuss the details or alternatively, please feel free to call us.'."\r\n".$message;
$subject = 'Checking availability with cats.co.uk';
if (!empty($email)) {
mail($email, $subject, $Usermessage, $headers);
}
I need the form to be sent to cats@cats.co.uk but it just isn't doing it for some reason?
I'm with GoDaddy hosting who apparently run PHP 5.2 if that makes any difference?
Please any help would be great, its terrible not having this work on the website.
Ash


