Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. // Tworzymy zmienną dla imienia i nazwiska
  4. $name = $_POST['name'];
  5.  
  6. // Tworzymy zmienną dla adresu email
  7. $email = $_POST['email'];
  8.  
  9. // Tworzymy zmienną dla wiadomości
  10. $message = $_POST['message'];
  11.  
  12. // Podajesz adres email na który chcesz otrzymać wiadomość
  13.  
  14. $headers = "From: [email protected]" .
  15.             "Reply-To: [email protected]" .
  16.             "X-Mailer: PHP/" . phpversion();
  17.  
  18. // Podajesz tytuł jaki ma mieć ta wiadomość email
  19. $tytul = "Formularz kontaktowy";
  20.  
  21. // Przygotowujesz treść wiadomości
  22. $wiadomosc .= "Imie i nazwisko: " . $name . "\n";
  23. $wiadomosc .= "Email: " . $email . "\n";
  24. $wiadomosc .= "Wiadomość: " . $message . "\n";
  25.  
  26. // Wysyłamy wiadomość
  27. $sukces = mail($to, $tytul, $wiadomosc, $headers, "Od: <$odkogo>");
  28.  
  29. // Przekierowywujemy na potwierdzenie
  30. if ($sukces){
  31.   print "<meta http-equiv=\"refresh\" content=\"0;URL=potwierdzenie.php\">";
  32. }
  33. else{
  34.   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement