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

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.