vedhæft fil i mailform
jeg har et problem. Har fundet følgende mail script men den sender kun billedet og ingen tekst. hvad er der galt???<?php
include ("../doc/dbconnect.php");
$email = mysql_query("SELECT * FROM mail2") or die ("Could not connect to the Database");
while ($list=mysql_fetch_array($email)) {
$mail=$list['mail'];
$name=$list['name'];
$boundary = uniqid('');
$mimeType = ($_FILES['filen']['type'] ? $_FILES['filen']['type'] : 'application/unknown');
$file = fread(fopen($_FILES['filen']['tmp_name'], 'r'), filesize($_FILES['filen']['tmp_name']));
$file = base64_encode($file);
$file = chunk_split($file);
$body = "\n--$boundary\n";
$body .= "Content-type: text/plain; charset=iso-8859-1\n";
$body .= "Content-transfer-encoding: 8bit\n\n";
$body .= $_POST['message']."\n\n";
$body .= "--$boundary\n";
$body .= "Content-type: $mimeType; name=".$_FILES['filen']['name']."\n";
$body .= "Content-disposition: attachment; filename=".$_FILES['filen']['name']."\n";
$body .= "Content-transfer-encoding: base64\n\n";
$body .= $file."\n\n";
$body .= "--$boundary--";
$headers = "Content-type: multipart/mixed; boundary=\"$boundary\"";
//$headers .= "From: Mouvin <info@test.dk> \n";
//$headers .= "Reply-To: info@test.dk \n";
mail($mail, $_POST['sub'], $body, $headers);
}
echo "den blev sendt!!!";
?>
