$Adi=$_POST['Adi'];
$attachment = $_FILES['attachment']['tmp_name'];
$attachment_name = $_FILES['attachment']['name'];
if (is_uploaded_file($attachment)) { //Do we have a file uploaded?
$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 = "From:mail@mail.com\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/related; charset='iso-8859-9'; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n";
//$headers .= "X-Mailer: PHP4\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/html; charset=\"iso-8859-9\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n";
$message .=
"<html>
<style type='text/css'>
<!--
.tahoma {
font-family:Tahoma;
color: #707982;
font-size: 12px;
}
.tahkalin {
font-family: Tahoma;
font-weight: bold;
color: #707982;
font-size: 12px;
}
-->
</style>
<body>
<table celpadding='5'>
<tr><td colspan='3'><br><hr><br></td></tr>
<tr><td colspan='3'><span class='tahkalin'>KİŞİSEL BİLGİLER</span><br><br></td></tr>
<tr>
<td valign='top'><span class='tahkalin'>Adı Soyadı</span></td>
<td valign='top'><span class='tahkalin'>: </span></td>
<td valign='top'><span class='tahoma'>$Adi</span></td>
</tr>
<tr><td colspan='3'><br><hr><br></td></tr>
</table>";
$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";
I wrote these code for the mail attachment. But there is a problem for these code. The atachment is sent but the form is not sent. I think, my problem is related to MIME format. How can I change it, please help... thanks..