Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 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 z którego ma być wysłana wiadomość
  13.  
  14.  
  15. // Podajesz adres email na który chcesz otrzymać wiadomość
  16. $to = "Wortix80@gmail.com";
  17.  
  18. $headers = "From: mateusz@burnagiel.cba.pl" .
  19.             "Reply-To: mateusz@burnagiel.cba.pl" .
  20.             "X-Mailer: PHP/" . phpversion();
  21.  
  22.  
  23. // Podajesz tytuł jaki ma mieć ta wiadomość email
  24. $tytul = "Formularz kontaktowy";
  25.  
  26. // Przygotowujesz treść wiadomości
  27. $wiadomosc .= "Imie i nazwisko: " . $name . "\n";
  28. $wiadomosc .= "Email: " . $email . "\n";
  29. $wiadomosc .= "Wiadomość: " . $message . "\n";
  30.  
  31. // Wysyłamy wiadomość
  32. $sukces = mail($to, $tytul, $wiadomosc, $headers, "Od: <$odkogo>");
  33.  
  34. // Przekierowywujemy na potwierdzenie
  35. if ($sukces){
  36.   print "<meta http-equiv=\"refresh\" content=\"0;URL=potwierdzenie.php\">";
  37. }
  38. else{
  39.   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
  40. }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement