Hi There,
I have created a site with 3 different contact forms on it. one which can upload a file as an attachment and 2 simaliar emails with out attachments.
Now when i developed these they worked fine, sending the email through to my personal hotmail account. But when i changed it over to the clients email nothing comes through. i have tried it to several different email address googlemail, yahoo etc and sems to be fine but when i send it to the clients nothing gets through. I imagine it is because of spam settings but cant be sure.
Please have a look at my code and see if there is anything that stand out
<?php
////////////////Email with attachment///////////////
$subject = Calls & Lines Contact Form';
$to_email = 'XXXXXXXXXXX@XXXXXXXXXXX.COM;
$attachment = $_FILES['attachment']['tmp_name'];
$attachment_name = $_FILES['attachment']['name'];
if (is_uploaded_file($attachment)) { //Check There is a file
$fp = fopen($attachment, "rb"); //Open it
$data = fread($fp, filesize($attachment)); //Read it
$data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can emailed
fclose($fp);
}
//Headers
$headers = "From: $name<$email>\n";
$headers .= "Reply-To: <$email>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n";
$headers .= "X-Sender: $name<$email>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
$headers .= "Return-Path: <$email>\n";
$headers .= "This is a multi-part message in MIME format.\n";
$headers .= "------=MIME_BOUNDRY_main_message \n";
$headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
$message = "------=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n";
//Message
$message .= "Name: $name\n";
$message .= "Company: $company\n";
$message .= "Email: $email\n";
$message .= "Tel: $tel\n";
$message .= "Date: $date\n";
$message .= "\n";
$message .= "Comment/Query: $comments\n";
$message .= "\n";
$message .= "------=MIME_BOUNDRY_message_parts--\n";
$message .= "\n";
$message .= "------=MIME_BOUNDRY_main_message\n";
$message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment;\n\tfilename=\"" . $attachment_name . "\"\n\n";
$message .= $data; //The base64 encoded message
$message .= "\n";
$message .= "------=MIME_BOUNDRY_main_message--\n";
// send the message
mail($to_email, $subject, $message, $headers);
print "<span class='formlabel'>Thank you for your comments/queries we will get back to you as soon as possible.</span><br />";
}
?>
Any help would be greatly appreciated, as i have no idea why it come through to mine but not the clients.
Thanks in advance