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("[email protected]"); else $mailto = Array("[email protected]","[email protected]"); $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\" <[email protected]>\n". "Date: ".date("r")."\n"; foreach($mailto as $value) { mail($value,$subject,$t_data,str_replace("[to]",$value,$headers)); } header("location: thank_you.html"); ?> Link to comment https://forums.phpfreaks.com/topic/145492-i-have-a-working-php5-form-but-i-need-to-add-autorespond/ Share on other sites More sharing options...
angelcool Posted February 18, 2009 Share Posted February 18, 2009 Use PHPMailer. Google it. Good Luck! Angel Link to comment https://forums.phpfreaks.com/topic/145492-i-have-a-working-php5-form-but-i-need-to-add-autorespond/#findComment-764892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.