|
19.11.2004, 08:45
#32790444
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
Ссылка на профиль пользователя:
|
|
|
Участник
Откуда: Томск
Сообщения: 807
Рейтинг:
0
/ 0
|
|
|
|
Почему мой скрипт выдаёт ошибку 500???
Вроде делаю всё как надо, отправка почты с вложением...
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70.
function SendMail($from_address, $to_address, $subject_mail, $message_mail,
$site_address){
$from="$from_address";
$to ="$to_address";
$subject="$subject_mail";
$message="$message_mail";
$to =strip_tags(trim($to));
$subject =strip_tags(trim($subject));
$from =strip_tags(trim($from));
$headers = "";
$message .="\n\n";
$message .="\n-------------------------------------\n";
$message .=" $site_address\n";
$message .=" $headers\n";
$from_address="ADP@Forum203";
@$send=mail($to,$subject,$message,"From: $from_address\r\nReply-To:
$from_address\r\nX-Mailer: ADP_FormMail");
}
if(!isset($step))
{
?>
<form ENCTYPE="multipart/form-data" action="test.php?step=1" method="post">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">
<INPUT NAME="fileatt" TYPE="file">
<input type="submit" value="Ввести данные">
</form>
<?
}
else
{
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$from = "diman@localhost";
if (is_uploaded_file($fileatt)) {
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$messaggio = "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$messaggio .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso- 8859 - 1 \"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$messaggio . "\n\n";
$data = chunk_split(base64_encode($data));
$messaggio .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
SendMail("Kelly <kelly@example.com>","Dmitry <diman@localhost>", "Subject", $messaggio,"http://localhost");
}
|
|
|