Hi!
I've desperately tried to find what's wrong with the following code:
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content_attachment = fread($handle, $file_size);
$type = mime_content_type($file);
fclose($handle);
$content_attachment = chunk_split(base64_encode($content_attachment));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content .= "--".$uid."\r\n";
$content .= "Content-Type:text/plain; charset=iso-8859-1\r\n";
$content .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$content .= $message."\r\n\r\n";
$content .= "--".$uid."\r\n";
$content .= "Content-Type: $type; name=\"".$filename."\"\r\n";
$content .= "Content-Transfer-Encoding: base64\r\n\r\n";
$content .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$content .= $content_attachment."\r\n\r\n";
$content .= "--".$uid."--";
if (mail($mailto, $subject, $content, $header)) {
echo "mail send ... OK"; // or use booleans here
}
else {
echo "mail send ... ERROR!";
}
It works perfectly when I comment the multipart/mixed part, but as soon as I take it in and if it's only this one line ($header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n", it doesn't work any more... anybody any idea why?
Thanks for any replies!
Kyeema