Advertisement
Guest User

Untitled

a guest
Jul 1st, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2.     $name = $_POST['name'];
  3.     $email = $_POST['email'];
  4.     $message = $_POST['message'];
  5.     $from = 'Autor';
  6.     $to = 'moj@mail.pl';
  7.     $subject = 'Wiadomosc ze strony';
  8.     $body = "Od: $name\n E-Mail: $email\n Wiadomosc:\n $message";
  9.  
  10.  
  11. if ($_POST['submit']) {
  12.     if (mail ($to, $subject, $body, $from)) {
  13.         print "<script>alert('Wiadomosc wyslana poprawnie');document.location.href='hhttp://www.example.pl/index.html';</script>";
  14.     } else {
  15.         print "<script>alert('Erorr');document.location.href='http://www.example.pl/index.html';</script>";
  16.     }
  17. }
  18. ?>
  19.  
  20.         <form method="post" action="mailer.php">
  21.             <input name="email" placeholder="Adres email" type="email"  required autofocus>
  22.             <input name="name" placeholder="Imię">
  23.             <textarea placeholder="Wpisz tutaj treść wiadomości :)" name="message"></textarea>
  24.             <input id="submit" name="submit" type="submit" value="Wyślij">
  25.         </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement