I have a web form, with a form page, and a confirmation page. The form page works fine, and transfers the variables over to the confirm page. But, when the email is processed, it doesnt work. As you see below, I have set up a simple "error" message if the mail doesnt go through. For some reason the form doesnt go through and I get the error message. Can anyone see what is wrong????
Below is the processing of the form to the email that needs to be sent out.........
<?php
$toaddress = $emailform;
$subject = "Web Form";
$to_email[] = "\r\nName ".$name;
$to_email[] = "\r\nAddress1: ".$address1;
$to_email[] = "\r\nAddress2: ".$address2;
$to_email[] = "\r\nCity: ".$city;
$to_email[] = "\r\nState: ".$state;
$to_email[] = "\r\nZip: ".$zip;
$to_email[] = "\r\nCountry: ".$country;
$to_email[] = "\r\nPhone: ".$telephone;
$to_email[] = "\r\nEmail: ".$email;
$joined_array = implode (" ", $to_email);
$mailcontent = $joined_array;
$headers = "From: ".$toaddress." \r\n";
$headers .= "Reply-To: ".$toaddress." \r\n";
$headers .= "Return-Path: ".$toaddress." \r\n";
$headers .= "CC: ".$cc_email1." \r\n";
if($cc_email2)
{
$headers .= "CC: ".$cc_email2." \r\n";
}
// $headers .= "BCC: [email]hidden@special.com[/email]\r\n";
// $headers .= "X-Priority: 3\r\n";
// $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
// $headers .= "Content-Transfer-Encoding: 8bit\r\n";
$sendmail = mail($toaddress, $subject, $mailcontent, $headers);
if($sendmail)
{
?>SUCCESS!<?php
} else {
?>ERROR!!!!<?php
}
?>