Jump to content

i have a working PHP5 form, but i need to add AutoRespond


domerdel

Recommended Posts

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");

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.