Advertisement
arkader

php mail contact

Nov 27th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <form action="sendemail.php">
  2.             <input type="email" name="email" autocomplete="on" autfocus="autofocus" placeholder="ENTER YOUR EMAIL">
  3.             <input type="submit" value="submit" name="submit">
  4. </form>
  5.  
  6. <?php
  7.        if(!empty($_POST))
  8.        {
  9.        // from the form
  10.        $email = trim(strip_tags($_POST['email']));
  11.        
  12.    
  13.        // set here
  14.        $subject = "Contact form submitted! $email";
  15.        $to = '24emal@gmail.com';
  16.  
  17.        $body = <<<HTML
  18. $email
  19. HTML;
  20.  
  21.        $headers = "From: $email\r\n";
  22.        $headers .= "Content-type: text/html\r\n";
  23.  
  24.        // send the email
  25.        mail($to, $subject, $body, $headers);
  26.  
  27.        // redirect afterwords, if needed
  28.        header('Location: index.php');
  29.        }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement