Form that collects email that needs to send a thank you email too.

So I have been searching on and off for three days and looking at lots of tutorials. I went with a simple solution but that is not working.

So we have a site that needs to collect emails and mail them to us as well as sending a information email to the submitter after a successful submission. Now this information email has to come from one email but my boss wants the reply to email to be different. I got the form working to send the emails to us and then had an auto responder through our control panel sending the info mail out but you cannot change the reply to address so every time someone replies they will get the auto response. So what I am going to do is include the code I have for the submit form in here and I would like to know if a confirmation email code snippet can be included in this code before the thank page code or what? Advise me if I need to make new files etc. If you can give me new code snippets to make a confirmation/info email to add to my current code snippet tell me exactly where to put it. I am a huge noob to php.
[php]

<?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "[email protected] , [email protected] , [email protected] , [email protected] , [email protected]"; $email_subject = "Please add me to the Updates!"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.

"; echo $error."

"; echo "Please go back and fix these errors.

"; die(); } // validation expected data exists if(!isset($_POST['email'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $email_from = $_POST['email']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.
'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Email: ".clean_string($email_from)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?>





Coming Fall 2011



thankyou blah blah blah.

Copyright © 2011 oursite <?php } [/php] Thanks for your help

In the two lines here

$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .

The first line shows the “from” email, the second shows the Reply To. You could define a new variable for the Reply To and use that instead of $email_from. As it stands you currently have both the From and the Reply To set to the same thing.

Thank you for your reply I may not have communicated what I wanted very effectively.

Currently the person puts their email in the form and a email is formed with their email address in it. I changed the emails to the same email but really it goes to several people.

What I want is a way to send that email plus an email to the submitter kind of like a welcome/thanks/info email. So essentially I want two different emails going out.

Sponsor our Newsletter | Privacy Policy | Terms of Service