domerdel Posted February 17, 2009 Share Posted February 17, 2009 i've developed a working PHP5 file to submit the form to the webmaster (info@). Now, the client wants me to add on a custom autoResponder. basically, the user fills out the form, the user gets an e-mail saying thank you in the subject line and body copy, says it came from info@ website. Here's the PHP script that's linked to it: <? error_reporting(1); if ( $_POST['tpl'] == "mail_req.tpl" ) $mailto = Array("kipp@test.com"); else $mailto = Array("test@test.com","test@gmail.com"); $subject="Celibre Web Inquiry: {$_POST['name']}"; if ( $_POST['tpl'] == "mail_req.tpl" ) { $t_data=file_get_contents("mail_req.tpl"); $subject="Req Cert Inquiry from Website"; } elseif ( $_POST['tpl'] ) $t_data=file_get_contents("mail_contact.tpl"); else $t_data = file_get_contents("mail_template.tpl"); foreach($_POST as $key=>$value) $t_data=str_replace("[".$key."]",$value,$t_data); if ( $_POST['companyname'] ) $fromname=$_POST['companyname']; elseif ( $_POST['name'] ) $fromname = $_POST['name']; else $fromname = $_POST['firstName'] . " " . $_POST['lastName']; $headers = "MIME-Version: 1.0\n". "Content-type: text/html; charset=iso-8859-1\n". "From: \"Website.com\" <info@website.com>\n". "Date: ".date("r")."\n"; foreach($mailto as $value) { mail($value,$subject,$t_data,str_replace("[to]",$value,$headers)); } header("location: thank_you.html"); ?> Quote Link to comment Share on other sites More sharing options...
angelcool Posted February 18, 2009 Share Posted February 18, 2009 Use PHPMailer. Google it. Good Luck! Angel Quote Link to comment 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.