Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $errorMSG = "";
- $name = $_POST["name"];
- $subjectx = $_POST["subject"];
- $message = $_POST["message"];
- $email = $_POST("email");
- if(empty($name)) {
- $errorMSG = "Imię jest wymagane";
- }
- if(empty($email)) {
- $errorMSG .= "E-Mail jest wymagany";
- }
- if(empty($subjectx)) {
- $errorMSG .= "Tytuł jest wymagany";
- }
- if(empty($message)) {
- $errorMSG .= "Treść wiadomości musi zostać uzupełniona";
- }
- $headers = 'MIME-Version: 1.0' . "\r\n";
- $headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
- $EmailTo = "jakuba001@interia.pl";
- $Subject = "Otrzymałeś nową wiadomość";
- // prepare email body text
- $Body = "";
- $Body .= "Imię: ";
- $Body .= $name;
- $Body .= "\n";
- $Body .= "Email: ";
- $Body .= $email;
- $Body .= "\n";
- $Body .= $subjectx;
- $Body .= "\n";
- $Body .= "Treść: ";
- $Body .= $message;
- $Body .= "\n";
- // send email
- $success = mail($EmailTo, $Subject, $Body, $headers);
- // redirect to success page
- if ($success && $errorMSG == ""){
- echo "Sukces";
- }else{
- if($errorMSG == ""){
- echo "Niestety, coś poszło nie tak";
- } else {
- echo $errorMSG;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement