Guest User

Untitled

a guest
Aug 30th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. PHP Form - Problem with reply e-mail
  2. <?php
  3. // Get Data
  4. $name = strip_tags($_POST['name']);
  5. $email = strip_tags($_POST['email']);
  6. $message = strip_tags($_POST['message']);
  7.  
  8. // Send Message
  9. mail( "Message from $name",
  10. "Name: $namenEmail: $emailnMessage: $messagen",
  11. "From: $name <forms@example.net>" );
  12. ?>
  13.  
  14. // Send Message
  15. mail($to_address, "Message from $name",
  16. // Message
  17. "Name: $namenEmail: $emailnMessage: $messagen",
  18. // Additional headers
  19. "From: $name <forms@example.net>rnReply-to: reply@example.com"
  20. );
  21.  
  22. bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
  23.  
  24. mail( $to,
  25. $subject,
  26. $message,
  27. "From: $name <forms@example.net>" );
  28.  
  29. <?php
  30. //define the receiver of the email
  31. $to = 'youraddress@example.com';
  32. //define the subject of the email
  33. $subject = 'Test email';
  34. //define the message to be sent. Each line should be separated with n
  35. $message = "Hello World!nnThis is my first mail.";
  36. //define the headers we want passed. Note that they are separated with rn
  37. $headers = "From: webmaster@example.comrnReply-To: webmaster@example.com";
  38. //send the email
  39. $mail_sent = @mail( $to, $subject, $message, $headers );
  40. //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
  41. echo $mail_sent ? "Mail sent" : "Mail failed";
  42. ?>
Add Comment
Please, Sign In to add comment