SHARE
TWEET

Untitled

a guest Dec 7th, 2019 265 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $errorMSG = "";
  4.  
  5. $name = $_POST["name"];
  6. $subjectx = $_POST["subject"];
  7. $message = $_POST["message"];
  8. $email = $_POST("email");
  9.  
  10.  
  11. if(empty($name)) {
  12.     $errorMSG = "Imię jest wymagane";
  13. }
  14.  
  15. if(empty($email)) {
  16.     $errorMSG .= "E-Mail jest wymagany";
  17. }
  18.  
  19. if(empty($subjectx)) {
  20.     $errorMSG .= "Tytuł jest wymagany";
  21. }
  22.  
  23. if(empty($message)) {
  24.     $errorMSG .= "Treść wiadomości musi zostać uzupełniona";
  25. }
  26.  
  27. $headers =  'MIME-Version: 1.0' . "\r\n";
  28. $headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";
  29. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  30.  
  31. $EmailTo = "jakuba001@interia.pl";
  32. $Subject = "Otrzymałeś nową wiadomość";
  33.  
  34. // prepare email body text
  35. $Body = "";
  36. $Body .= "Imię: ";
  37. $Body .= $name;
  38. $Body .= "\n";
  39. $Body .= "Email: ";
  40. $Body .= $email;
  41. $Body .= "\n";
  42. $Body .= $subjectx;
  43. $Body .= "\n";
  44. $Body .= "Treść: ";
  45. $Body .= $message;
  46. $Body .= "\n";
  47.  
  48. // send email
  49. $success = mail($EmailTo, $Subject, $Body, $headers);
  50.  
  51. // redirect to success page
  52. if ($success && $errorMSG == ""){
  53.    echo "Sukces";
  54. }else{
  55.     if($errorMSG == ""){
  56.         echo "Niestety, coś poszło nie tak";
  57.     } else {
  58.         echo $errorMSG;
  59.     }
  60. }
  61.  
  62. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top