файл по почте [непонятный глюк]
Ниже код.
[COLOR=darkblue]
<?
$f = mkMessage("Тело",$HTTP_POST_FILES['userfile']);
$to="test@test.ru";
$subject = "test";
$message=$f;
$email="test@test.ru";
mail($to,$subject,$message, "From: $email\r\nReply-to: $email\r\n");
function mkMessage($body,$attachment)
{
$boundary ='b' . md5(mt_rand());
$ret .= 'Content-type: multipart/mixed; ';
$ret .= "boundary = \"$boundary\"\r\n\r\n";
$ret .= "This is a MIME message.\r\n\r\n";
$ret .= "--$boundary";
$ret .= "Content-type: text/plain\r\n";
$ret .= "Content-Transfer-Encoding: 8bit\r\n\r\n ";
$ret .= $body . "\r\n--$boundary";
$h=fopen($attachment['tmp_name'],'r');
$data = fread($h,$attachment['size']);
fclose($h);
$data = base64_encode($data);
$data = chunk_split($data);
$block = "Contant-type: ".$attachment['type'].
"; name = \"". $attachment['name']."\"\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n" .
$data . "\r\n";
$ret .= "\r\n--$block--$boundary";
$ret .= "--\r\n";
return($ret);
}
?>[/COLOR]