ea0184 Posted August 7, 2009 Share Posted August 7, 2009 I have a php form processor/thank you that I got for free. I have it directed to my email, and and autoresponder, but the auto-responder is not auto-responding. Can I just add script to my current form so that the user recieves an email with links automatically? I don't want them to verify their email address, but I do want to send them a link here is the thank you/form processor: Enter the email address below to send the contents of the form to. You can enter more than one email address separated by commas, like so: $my_email = "info@example.com"; or $my_email = "bob@example.com,sales@example.co.uk,jane@example.com"; */ $my_email = "noreply_weightloss@w8trainher.com,myemail@hotmail.com"; /* */ $continue = "http://www.w8trainher.com"; /* */ $errors = array(); // Remove $_COOKIE elements from $_REQUEST. if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} // Validate email field. if(isset($_REQUEST['Email']) && !empty($_REQUEST['Email'])) { $_REQUEST['Email'] = trim($_REQUEST['Email']); if(substr_count($_REQUEST['Email'],"@") != 1 || stristr($_REQUEST['Email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['Email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } // Check referrer is from same site. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} // Check for a blank form. function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); // Display any errors and exit if errors exist. if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;} if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} // Build message. function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");} $message = build_message($_REQUEST); $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Weight Loss"; $message = stripslashes($message); $subject = "Weight_Loss"; $subject = stripslashes($subject); $from_name = ""; if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name = stripslashes($_REQUEST['name']);} $headers = "From: {$from_name} <{$_REQUEST['email']}>"; mail($my_email,$subject,$message,$headers); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Weight Loss</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#D0A6CC" text="#000000"> <div> <center> <img src="siteassistpro_images/w8train21logo_small.png"> </center></div> <div> <center> <b>Thank you <?php if(isset($_REQUEST['Name'])){print stripslashes($_REQUEST['Name']);} ?></b> <p><b>Your request has been sent to the email address you have provided.<br> Be sure to check spam folder.</b><br></p> <p><a href="javascript:window.close()">Click here to continue</a></p> </center> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/ Share on other sites More sharing options...
mikesta707 Posted August 7, 2009 Share Posted August 7, 2009 jesus christ that code is ridiculous. Wrap in some code tags and format it a little bit please. I don't understand what you want really Quote Link to comment https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/#findComment-893210 Share on other sites More sharing options...
ea0184 Posted August 7, 2009 Author Share Posted August 7, 2009 my goal is to have this script send the user an email with links on top of sending me their contact info. right now it only sends me their info. Sorry I am new to php... Enter the email address below to send the contents of the form to. You can enter more than one email address separated by commas, like so: $my_email = "info@example.com"; or $my_email = "bob@example.com,sales@example.co.uk,jane@example.com"; */ $my_email = "noreply_weightloss@w8trainher.com,antillon0184@hotmail.com"; /* */ $continue = "http://www.w8trainher.com"; /* */ $errors = array(); // Remove $_COOKIE elements from $_REQUEST. if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}} // Validate email field. if(isset($_REQUEST['Email']) && !empty($_REQUEST['Email'])) { $_REQUEST['Email'] = trim($_REQUEST['Email']); if(substr_count($_REQUEST['Email'],"@") != 1 || stristr($_REQUEST['Email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['Email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } // Check referrer is from same site. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} // Check for a blank form. function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); // Display any errors and exit if errors exist. if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;} if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} // Build message. function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");} $message = build_message($_REQUEST); $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Weight Loss"; $message = stripslashes($message); $subject = "Weight_Loss"; $subject = stripslashes($subject); $from_name = ""; if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name = stripslashes($_REQUEST['name']);} $headers = "From: {$from_name} <{$_REQUEST['email']}>"; mail($my_email,$subject,$message,$headers);?> Quote Link to comment https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/#findComment-893218 Share on other sites More sharing options...
mikesta707 Posted August 7, 2009 Share Posted August 7, 2009 Ok. just use the mail function to email them. PHP.net page http://us2.php.net/manual/en/function.mail.php tutorial on mail function http://www.w3schools.com/PHP/php_mail.asp Quote Link to comment https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/#findComment-893220 Share on other sites More sharing options...
ea0184 Posted August 7, 2009 Author Share Posted August 7, 2009 I tried a few things from the tutorials you provided, and I have had no success....One way it did work but it just sent the user their own contact info. I would like for the form to send me their info, and send the user the thank you note with the link.... The biggest issue here is I am very ignorant when it comes to php I really appreciate your time. Quote Link to comment https://forums.phpfreaks.com/topic/169267-add-a-email-confimation-to-existing-php/#findComment-893259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.