I recently created a Flash form that sends an email using PHP. I want the email sent to the set address to automatically respond to the person who filled out the form with another email. The problem I’m having is that since the email was sent using my server, the autoresponder doesnt have the address to send its next email, even though the From: field has the persons email address in it.
Here is what my code looks like:
<?
if(!empty($HTTP_POST_VARS[‘sender_mail’]) || !empty($HTTP_POST_VARS[‘sender_message’]) || !empty($HTTP_POST_VARS[‘sender_subject’]) || !empty($HTTP_POST_VARS[‘sender_name’]))
{
$to = “myemail@myaddress.com”;
$subject = stripslashes($HTTP_POST_VARS[‘sender_name’]);
$body = stripslashes($HTTP_POST_VARS[‘sender_text4’]);
$body .= "
";
$body .= “Pledge made by: " . $HTTP_POST_VARS[‘sender_name’] . " <” . $HTTP_POST_VARS[‘sender_mail’] . ">
";
$body .= "Street: " . $HTTP_POST_VARS[‘sender_subject’] . "
";
$body .= "City: " . $HTTP_POST_VARS[‘sender_message’] . "
";
$body .= "State: " . $HTTP_POST_VARS[‘sender_text’] . "
";
$body .= "ZIP: " . $HTTP_POST_VARS[‘sender_text2’] . "
";
$body .= "Country: " . $HTTP_POST_VARS[‘sender_text3’] . "
";
$body .= "Comments: " . $HTTP_POST_VARS[‘sender_text4’];
$header = “From: " . $HTTP_POST_VARS[‘sender_name’] . " <” . $HTTP_POST_VARS[‘sender_mail’] . ">
";
$header .= “Reply-To: " . $HTTP_POST_VARS[‘sender_name’] . " <” . $HTTP_POST_VARS[‘sender_mail’] . ">
";
$header .= “X-Mailer: PHP/”. phpversion(), “-f $header”);
$header .= “X-Priority: 1”;
if(@mail($to, $subject, $body, $header))
{
echo “output=sent”;
} else {
echo “output=error”;
}
} else {
echo “output=error”;
}
?>
I basically want the person who filled out the form to be able to receive a confirmation email directly afterwords.