Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
92
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. $to = "sadsadas@gmail.com";
  14.  
  15. $headers = "From: sdas@asdasd.cba.pl" .
  16.             "Reply-To: sdas@asdasd.cba.pl" .
  17.             "X-Mailer: PHP/" . phpversion();
  18.  
  19. // Podajesz tytuł jaki ma mieć ta wiadomość email
  20. $tytul = "Formularz kontaktowy";
  21.  
  22. // Przygotowujesz treść wiadomości
  23. $wiadomosc .= "Imie i nazwisko: " . $name . "\n";
  24. $wiadomosc .= "Email: " . $email . "\n";
  25. $wiadomosc .= "Wiadomość: " . $message . "\n";
  26.  
  27. // Wysyłamy wiadomość
  28. $sukces = mail($to, $tytul, $wiadomosc, $headers, "Od: <$odkogo>");
  29.  
  30. // Przekierowywujemy na potwierdzenie
  31. if ($sukces){
  32.   print "<meta http-equiv=\"refresh\" content=\"0;URL=potwierdzenie.php\">";
  33. }
  34. else{
  35.   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement