text"; $file = "file.doc"; $EOL = "\r\n"; $open = fopen($file, "rb"); $boundary = "--".md5(uniqid(time())); $headers = "MIME-Version: 1.0;$EOL"; $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"$EOL"; $headers .= "From: $from"; $multipart = "--$boundary$EOL"; $multipart .= "Content-Type: text/html; charset=windows-1251$EOL"; $multipart .= "Content-Transfer-Encoding: base64$EOL"; $multipart .= $EOL; $multipart .= chunk_split(base64_encode($html)); $multipart .= "$EOL--$bondary$EOL"; $multipart .= "Content-Type: application/octet-stream; name=\"$file\"$EOL"; $multipart .= "Content-Transfer-Encoding: base64$EOL"; $multipart .= "Content-Disposition: attachment; filename=\"$file\"$EOL"; $multipart .= $EOL; $multipart .= chunk_split(base64_encode(fread($open, filesize($file))))."\n"; $multipart .= "$EOL--$bondary--$EOL"; if (mail($to, $subject, $muitipart, $headers)) { echo "сообщение отправленно"; } } //-------------------------------------------------- ?>