Guest User

PHP Email

a guest
Jun 13th, 2017
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <?php
  2. $to = '[email protected]'; // Put in your email address here
  3. $subject = "Nuevo mensaje desde Hotel Astor"; // The default subject. Will appear by default in all messages. Change this if you want.
  4.  
  5. // User info (DO NOT EDIT!)
  6. $name = stripslashes($_REQUEST['name']); // sender's name
  7. $phone = stripslashes($_REQUEST['phone']); // sender's name
  8. $email = stripslashes($_REQUEST['email']); // sender's mail
  9. $message = stripslashes($_REQUEST['message']); // sender's mail
  10.  
  11.  
  12. // The message you will receive in your mailbox
  13. // Each parts are commented to help you understand what it does exaclty.
  14. // YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
  15. $msg .= "Nombre: ".$name."\r\n"; // add sender's name to the message
  16. $msg .= "Email: ".$email."\r\n"; // add sender's email to the message
  17. $msg .= "Mensaje: ".$message."\r\n"; // add sender's email to the message
  18.  
  19.  
  20. $msg .= "Asunto: ".$subject."\r\n\n"; // add subject to the message (optional! It will be displayed in the header anyway)
  21. $msg .= "\r\n\n";
  22.  
  23. $mail = @mail($to, $subject, $msg, "From:".$email); // This command sends the e-mail to the e-mail address contained in the $to variable
  24. /*
  25. header("Location: http://marcehernandez.com/");
  26. //This is the message that will be shown when the message is successfully send
  27. //exit;*/
  28.  
  29.  
  30.  
  31. if($mail) {
  32.  
  33. echo "asd";
  34. header("Location: http://marcehernandez.com/");
  35.  
  36. } else {
  37. echo 'Your message not sent.'; //This is the message that will be shown when an error occured: the message was not send
  38. }
  39.  
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment