stealthmode666
12-11-2008, 12:29 AM
How do I write php to read the email from a form and send the auto reply to the user who filled in their email address in the form in php?
This is the script I am Using.
At present it sends the data to me from the form and shows me the users e-mail addredd who filled it in and displays the thank-you page, but it also sends me the auto reply.
Here is my script
<?php
$to = ( isset ($_REQUEST['sendto']) ? $_REQUEST['sendto'] : "default 'to' email goes here" );
$from = ( isset ($_REQUEST['Email']) ? $_REQUEST['sendto'] : "default 'from' email goes here" ) ;
$name = ( isset ($_REQUEST['Member_Name']) ? $_REQUEST['Member_Name'] : "Default member name goes here" ) ;
$headers = "From: $from";
$subject = "Members Data From R.......com";
$fields = array();
$fields{"Member_Name"} = "Members Name";
$fields{"Email"} = "Members Email Address";
$fields{"....."} = "......";
$body = " You have received...:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: me@somewhere.com";
$subject2 = "Thank-you for ..";
$autoreply = "Somebody from... Thank-you";
if($from == '') {print "You have..";}
else {
if($name == '') {print "You have..";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send){header( "Location: http://www.r....com/r../thankyou.html" );}
else
{print "We encountered ...@.....com"; }
}
}
?>
This is the script I am Using.
At present it sends the data to me from the form and shows me the users e-mail addredd who filled it in and displays the thank-you page, but it also sends me the auto reply.
Here is my script
<?php
$to = ( isset ($_REQUEST['sendto']) ? $_REQUEST['sendto'] : "default 'to' email goes here" );
$from = ( isset ($_REQUEST['Email']) ? $_REQUEST['sendto'] : "default 'from' email goes here" ) ;
$name = ( isset ($_REQUEST['Member_Name']) ? $_REQUEST['Member_Name'] : "Default member name goes here" ) ;
$headers = "From: $from";
$subject = "Members Data From R.......com";
$fields = array();
$fields{"Member_Name"} = "Members Name";
$fields{"Email"} = "Members Email Address";
$fields{"....."} = "......";
$body = " You have received...:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: me@somewhere.com";
$subject2 = "Thank-you for ..";
$autoreply = "Somebody from... Thank-you";
if($from == '') {print "You have..";}
else {
if($name == '') {print "You have..";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send){header( "Location: http://www.r....com/r../thankyou.html" );}
else
{print "We encountered ...@.....com"; }
}
}
?>