السلام عليكم.
لقد قمت بتصميم هذا الكود، و الغرض منه إرفاق ملف برسالة بريد إلكتروني. لكن هناك مشكلة لم أتمكن من حلها، وهي أنه لا يتم ارفاق اي ملف مع الرسالة مع العلم أنه أيضاً لا يظهر لي أي رسالة خطأ، وتصل الرسالة على هذا النحو:

وهذا هو الكود:
<?php
$mailTo = '11111111@hotmail.com';
$mailFrom = '11111111@hotmail.com';
$header[] ="From: Mazen <$mailFrom>\r\nReply-to: $mailFrom\r\nBCC: 'mail@tech-sy.com,mazenwrq@hotmail.com'\r\nCc :$mailFrom ";
$body = 'Welcome Everybody';
$files[0]['file'] = 'image/loading.gif';
$files[0]['filename'] = 'loading.gif';
$files[0]['filetype'] = 'image/gif';
//$header = array();
$type = 'text/plain';
$charset = 'us-ascii';
$encoding = '8bit';
$hasAttacch = 1;
//$files = array();
$mimeType = 'application/octet-stream';
$mimeVersion = 'MIME-Version: 1.0';
$mimeMesg = 'This is a multi-part message in MIME format.';
$mailer = 'my Mime Mailer 1.0';
$boundary = '';
$errorFile = 'can\'t open the File';
$header[] = "XMailer: ".$mailer;
$header[] = $mimeVersion;
if($hasAttacch){
$boundary = md5(uniqid(time()));
$header[] = "Content-Type: multipart/mixed; boundary =\"$boundary\"\r\n";
$header[] = $mimeMesg."\r\n";
$header[] = "--$boundary";
}
$header[] = "Content-Type: $type; charset: $charset";
$header[] = "Content-Transfer-Encoding: $encoding";
if(!$hasAttacch){
echo 'No File in this message.';
}else{
$bodyPart[0] = $body."\r\n";
for($i = 0; $i < count($files); $i ++){
if(!$fp = fopen($files[$i]['file'], "r")) echo $errorFile.'<br />';
$fileBody = fread($fp, filesize($files[$i]['file']));
$fileBody = chunk_split(base64_encode($fileBody)); //what is work (chunk_split())
$bodyPart[$i + 1] = "--$boundary \r\n";
if(!empty($files[$i]['filetype'])){
$mimeType = $files[$i]['filetype'];
}
$bodyPart[$i + 1] .= "Content-Type: ".$mimeType.";name= ".basename($mimeType = $files[$i]['filename'])."\r\n";
$bodyPart[$i + 1] .= "Conent-Transfer-Encoding: base64\r\n\r\n";
$bodyPart[$i + 1] .= $fileBody;
}
$bodyPart[$i + 1] .= "--$boundary--";
$body = implode(" ", $bodyPart);
$headers = implode("\r\n", $header);
}
$subject = 'this is the one mail fo my programming';
if(mail($mailTo,$subject,$body,$headers)>0){
echo 'Successfully send an email '.$subject;
}else{
echo 'error';
}
?>طبعاً قمت بوضع بريد حقيقي بدلاً من
11111111@hotmail.com
فهل أجد عند أحدكم الحل؟؟؟؟؟؟؟؟؟