Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP] Proźba o pomoc w edycji skryptu
marjaan
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 13.10.2009

Ostrzeżenie: (0%)
-----


Witam wszystkich.

Jestem początkujący jeśli chodzi i PHP

Czytałem wiele postów na temat wysyłania maila z załącznikiem, próbowałem na jego podstawie samodzielnie modyfikować skrypt który posiadam, tak by za jego pomocą można było wysyłać więcej niż jeden załącznik... niestety bezskutecznie (IMG:style_emoticons/default/sadsmiley02.gif)

Byłbym wdzięczny jeśli pomoglibyście mi w edycji tego skryptu, tak by mógł wysyłać wiele załączników, z góry dziękuję

  1. <?php
  2. $arrLocale = array( "pl_PL", "polish_pol" );
  3. setlocale( LC_ALL, $arrLocale );
  4.  
  5. $data = strftime("%A, %d %B %Y");
  6. $boundary = "-->===_54654747_===<---->>4255==_";
  7.  
  8. $head = "From: $email\n";
  9. $head = $head . "Reply-To: $email\n";
  10. $head = $head . "X-Mailer: PHP\n";
  11. $head = $head . "X-Sender: $email\n";
  12. $head = $head . "MIME-version: 1.0\n";
  13. $head = $head . "Content-type: multipart/mixed; ";
  14. $head = $head . "boundary=\"$boundary\"\n";
  15. $head = $head . "Content-transfer-encoding: 7BIT\n";
  16. $head = $head . "X-attachments: $filename_name;\n\n";
  17.  
  18.  
  19.  
  20. $mesg = "--" . $boundary . "\n";
  21. $mesg = $mesg . "Content-Type: text/plain; charset=\"iso-8859-2\"\n\n";
  22. $mesg = $mesg
  23.  
  24. .$numer = "Numer zlecenia: $numer" ." "
  25. .$data1 = "Data: $data1" ."\n"
  26. .$zleceniodawca = "Zleceniodawca: $zleceniodawca" ."\n"
  27. .$z_jezyka = "Tlumaczenie z jezyka: $z_jezyka" ." "
  28. .$na_jezyk = "na jezyk: $na_jezyk" ."\n"
  29. .$dane = "Dane do rachunku: $dane" ."\n"
  30. .$telefon = "Telefon: $telefon" ."\n"
  31. .$uwagi = "Uwagi: $uwagi" ."\n"
  32. .$www = "Strona www: $www" ."\n"
  33. .$email = "E-MAIL: $email" ."\n"
  34. .$data = "Wysłano dnia: $data" ."\n";
  35.  
  36. $mesg = $mesg . "--" . $boundary . "\n";
  37. $mesg = $mesg . "Content-type: " . $filename_type . "; name=\"$filename_name\";\n";
  38. $mesg = $mesg . "Content-Transfer-Encoding: base64\n";
  39. $mesg = $mesg . "Content-disposition: attachment; filename= \"$filename_name\"\n\n";
  40. $mesg = $mesg . fileopenanddecode($filename) . "\n";
  41. $mesg = $mesg . "--" . $boundary . "-- \n";
  42.  
  43.  
  44.  
  45. function fileopenanddecode($file) {
  46. if (is_readable($file)) {
  47. $fd = fopen($file, "r");
  48. $plik = fread($fd, filesize($file));
  49. $encoded = chunk_split(base64_encode($plik));
  50. fclose($fd);
  51. }
  52. return $encoded;
  53. }
  54.  
  55.  
  56.  
  57. mail("mojmail@wp.pl", "ZLECENIE ON LINE", $mesg , $head);
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. ?>
  65.  
  66. <html>
  67.  
  68. <head>
  69. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
  70. <meta http-equiv="Content-Language" content="pl">
  71. <link rel="Shortcut icon" href="images/ikonka.ico" />
  72. <title>Zlecenie</title>
  73. </head>
  74.  
  75. <body bgcolor="#9D826D">
  76.  
  77. <p align="left">
  78. <p></p>
  79. <p></p>
  80. <font face="Arial" style="font-size: 14px" color="#FFFFFF"><b>Dziękuję, Twoje dane zostały przesłane!</b></font>
  81. <p></p>
  82. <button name="B3" onclick="java script:history.back();">Kolejne zlecenie
  83. </button></p>
  84. </body>
  85.  
  86. </html>



Na podstawie różnych postów na forum domyślam się że trzeba edytować poniższą część, ale niestety nie udało mi się tego zrobić samodzielnie

  1.  
  2. $mesg = $mesg . "--" . $boundary . "\n";
  3. $mesg = $mesg . "Content-type: " . $filename_type . "; name=\"$filename_name\";\n";
  4. $mesg = $mesg . "Content-Transfer-Encoding: base64\n";
  5. $mesg = $mesg . "Content-disposition: attachment; filename= \"$filename_name\"\n\n";
  6. $mesg = $mesg . fileopenanddecode($filename) . "\n";
  7. $mesg = $mesg . "--" . $boundary . "-- \n";
  8.  
  9.  
  10.  
  11. function fileopenanddecode($file) {
  12. if (is_readable($file)) {
  13. $fd = fopen($file, "r");
  14. $plik = fread($fd, filesize($file));
  15. $encoded = chunk_split(base64_encode($plik));
  16. fclose($fd);
  17. }
  18. return $encoded;
  19. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 01:35