Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['submit'])){
  3. $to = "abc123@hotmail.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. $subject2 = "Copy of your form submission";
  9. $message = $first_name . " " . $last_name . " wrote the following:" . "nn" . $_POST['message'];
  10. $message2 = "Here is a copy of your message " . $first_name . "nn" . $_POST['message'];
  11.  
  12. $headers = "From:" . $from;
  13. $headers2 = "From:" . $to;
  14. mail($to,$subject,$message,$headers);
  15. mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
  16. echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
  17. // You can also use header('Location: thank_you.php'); to redirect to another page.
  18. }
  19. ?>
  20.  
  21. <form action="" method="post">
  22. First Name: <input type="text" name="first_name"><br><br>
  23. Last Name: <input type="text" name="last_name"><br><br>
  24. Email: <input type="text" name="email"><br><br>
  25. Message:<br><textarea rows="5" name="message" cols="30"></textarea><br><br>
  26. <input type="submit" name="submit" value="Submit">
  27. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement