Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Yahoo Answer for http://answers.yahoo.com/question/index?qid=20140311165634AAHSwKV
- $usrEmail = $_POST['email']; // Store it in a variable so that you can add security, more easily, later.
- $usrName = $_POST['name'];
- $usrPhone = $_POST['phone'];
- $usrMessage = $_POST['message'];
- $ToEmail = 'noSpam@hotmail.com';
- $EmailSubject = 'Message from Business';
- $mailheader = "From: " . $usrEmail . "\r\n";
- $mailheader .= "Reply-To: " . $usrEmail . "\r\n";
- $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
- $MESSAGE_BODY = "name: " . $usrName . "";
- $MESSAGE_BODY .= "email: " . $usrEmail . "";
- $MESSAGE_BODY .= "phone: " . $usrPhone . "";
- $MESSAGE_BODY .= "message: " . nl2br($usrMessage) . "";
- if( mail( $ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) ){
- header ("Location: http://www.google.com/");
- // Placing the header() call causes the script to stop processing and output the change of location header
- // This way, it will only redirect on successful mail sent.
- }else {
- echo "Failure";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement