Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])){
  3. $to = "email@example.com"; // this is your Email address
  4. $from = $_POST['email']; // this is the sender's Email address
  5. $first_name = $_POST['first_name'];
  6. $last_name = $_POST['last_name'];
  7. $subject = "Form submission";
  8. $message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
  9.  
  10. $headers = "From:" . $from;
  11.  
  12. mail($to,$subject,$message,$headers);
  13.  
  14. echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
  15.  
  16. }
  17. ?>
  18. <html>
  19. <head>
  20. </head>
  21. <body>
  22. <form action="" method="post">
  23. First Name: <input type="text" name="first_name"><br>
  24. Last Name: <input type="text" name="last_name"><br>
  25. Email: <input type="text" name="email"><br>
  26. Message:<br><textarea rows="5" name="message" cols="30"></textarea><br>
  27. <input type="submit" name="submit" value="Submit">
  28. </form>
  29. </form>
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement