Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pilnie potrzebne! PHP, Dlaczego plik .php nie wysyła wiadomości e-mail?
dthard
post 19.10.2014, 19:34:35
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 19.10.2014

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


Co w tym kodzie jest nie tak?
Dlaczego nie wysyła wiadomości e-mail?


  1. <?php
  2. if (count($_POST))
  3. {
  4. ////////// USTAWIENIA //////////
  5. $email = 'dandi2001@o2.pl'; // Adres e-mail adresata
  6. $subject = 'Nowe konto'; // Temat listu
  7. $message = '--------------------------------------------!'; // Komunikat
  8. $error = 'Wystąpił błąd podczas wysyłania formularza'; // Komunikat błędu
  9. $charset = 'iso-8859-2'; // Strona kodowa
  10. //////////////////////////////
  11. $head =
  12. "MIME-Version: 1.0\r\n" .
  13. "Content-Type: text/plain; charset=$charset\r\n" .
  14. "Content-Transfer-Encoding: 8bit";
  15. $body = '';
  16. foreach ($_POST as $name => $value)
  17. {
  18. if (is_array($value))
  19. {
  20. for ($i = 0; $i < count($value); $i++)
  21. {
  22. $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
  23. }
  24. }
  25. else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
  26. }
  27. echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
  28. }
  29. else
  30. {
  31. ?>
  32. <form action="?" method="post">
  33. Tutaj umieść wszystkie pola formularza
  34. </form>
  35. <?php
  36. }
  37. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 13.08.2025 - 23:23