scott botkins Posted February 4, 2007 Share Posted February 4, 2007 What I'm wanting to do is when I open outlook and hit reply it will reply the email to the email field people have filled out instead of replying to the email the form was sent too. Below is my code... <?php $subject = 'Email Subject'; // Subject of email sent to you. $emailadd = 'email@email.com'; // Your email address. This is where the form information will be sent. $url = 'http://www.site.com/success.html'; // Where to redirect after form is processed. $req = '0'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "";die;} } $j = strlen($key); if ($j >= 30) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> Thanks a ton for any help provided! Quote Link to comment Share on other sites More sharing options...
kickassamd Posted February 4, 2007 Share Posted February 4, 2007 Try this, should work, I dont have a way to test it ATM. Just replace your mail function with what i have provided below. $headers = 'From: '.$emailadd.' \r\n'; $headers .= 'Reply-To: '.$emailadd.' \r\n'; $headers .= 'X-Mailer: PHP v '.phpversion(). '\r\n'; mail($emailadd, $subject, $text, $headers); Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 talking about this, does anyone know there exist any "free" host that has mail() enabled? Thanks for the information Ted Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 well there will be a good site within the next few weeks, unless my friend already opened it, called flexy host. they have free i think. check: www.flexy-hosting.com think thats the link. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Share Posted February 4, 2007 i know of addyour.net, but its not very reliable Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 thanks, ProjectFear, thats the right link i think, cannot signup yet: We are sorry to inform you that due to the fact that we have recently purchased a new dedicated server, hosting sign-ups have been disabled. We promise to have everything moved by next week. but i will try to wait, thanks PC Nerd, i will check it out. Ted Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 4, 2007 Share Posted February 4, 2007 i no the owner, i could speak to him if you want. he's my friend from school. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 4, 2007 Share Posted February 4, 2007 yes please, after seeing the features, i think is the best free host offer i had ever seen! Ted Quote Link to comment Share on other sites More sharing options...
scott botkins Posted February 4, 2007 Author Share Posted February 4, 2007 Thanks kickassamd for guiding me in the right direction. I did it a little differently but still used your From: I just added $client = $_POST['Email']; at the top and then $headers = 'From: '.$client.''; mail($emailadd, $subject, $text, $headers); at the bottom which works perfectly. Thanks! Quote Link to comment Share on other sites More sharing options...
kickassamd Posted February 6, 2007 Share Posted February 6, 2007 Glad i could help 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.