функция по отправке файла с сервера себе на мыло
function download_mail($dir,$file) {
$demail="Ваше@мыло.ру";
$buf = explode(".", $file);
$dir = str_replace("\\","/",$dir);
$fullpath = $dir."/".$file;
$size = tinhbyte(filesize($fullpath));
$fp = fopen($fullpath, "rb");
while(!feof($fp))
$attachment .= fread($fp, 4096);
$attachment = base64_encode($attachment);
$subject = "тема сообщения ($file)";
$boundary = uniqid("NextPart_");
$headers = "From: $demail\nContent-type: multipart/mixed; boundary=\"$boundary\"";
$info = "---==== Сообщение от ($demail)====---\n\n";
$info .= "IP:\t$REMOTE_ADDR\n";
$info .= "HOST:\t$HTTP_HOST\n";
$info .= "URL:\t$HTTP_REFERER\n";
$info .= "DOC_ROOT:\t$PATH_TRANSLATED\n";
$info .="--$boundary\nContent-type: text/plain; charset=iso-8859-1\nContent-transfer-encoding: 8bit\n\n\n\n--$boundary\nContent-type: application/octet-stream; name=$file \nContent-disposition: inline; filename=$file \nContent-transfer-encoding: base64\n\n$attachment\n\n--$boundary--";
$send_to = "$demail";
$send = mail($send_to, $subject, $info, $headers);
if($send == 2)
echo "<br>
<center>
Спасибо!!!Файл <b>$file</b> отправлен вам на <u>$demail</u>.</center><br>";
fclose($fp);
}