Please assist, below is my code. Everything works perfectly except the second mail() function that is suppose to email the responder with a thank you email as well but it does not. WHY???????
Code:
<?php
$to = "lynette@skies.co.za";
$from = $_REQUEST['email'] ;
$fields = array();
$fields{"firstname"} = "First name";
$fields{"lastname"} = "Last name";
$fields{"email"} = "Email";
$fields{"telephone"} = "Telephone number";
$fields{"type"} = "Type of Feedback";
$fields{"purchase"} = "Purchase a Yorkie";
$fields{"owner"} = "Own a Yorkie";
$fields{"qnty"} = "How many";
$fields{"breeder"} = "Breeder";
$fields{"letter"} = "Subscribe to Letters";
$fields{"pups"} = "Subscribe to new Pups";
$fields{"updates"} = "Subscribe to Updates";
$fields{"registrations"} = "Subscribe to Registrations";
$fields{"message"} = "Message";
$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){
$body .= sprintf("%22s: %s\n", $b, $_REQUEST[$a]);
}
$subject = "SA Yorkies - Contact Form";
$subject2 = "Thank you for contacting us";
$headers = "From: $from";
$headers2 = "From: lynette@skies.co.za";
$autoreply = "Thank you for contacting us. We will get back to you as soon as possible, usualy within 48 hours.
If you have any more questions, please email us at: lynette@skies.co.za
or visit our website at: www.skies.co.za";
mail($from, $subject2, $autoreply, $headers2);
$send = mail($to, $subject, $body, $headers);
echo $send2;
if($send) {
header( "Location: http://www.skies.co.za/thankyou.html" );
}
else {
print "We encountered an error sending your mail, please notify lynette@sayorkies.co.za";
}
?>