Forum Moderators: coopster
One change I already made was shortening "$HTTP_POST_VARS" to "$_POST", but otherwise I'm stuck. If it helps, the front end for our form is a Flash (SWF) file. I've sent several tests, but have not received any of them.
Thanks in advance for any advice.
<?php
if(!empty($_POST['sender_message']))
{
$to = "info@companyname.com";
$subject = stripslashes($_POST['sender_subject']);
$body .= "\n\n--------------------------------------------------\n" .
"CONTACT FORM" .
"\n--------------------------------------------------\n" .
"Name: " . $_POST['sender_name'] . "\n" .
"Address: " . $_POST['sender_address'] . "\n\n" .
"Daytime Phone: " . $_POST['sender_phoneDay'] . "\n" .
"Email: " . $_POST['sender_email'] . "\n\n" .
"City: " . $_POST['sender_city'] . "\n" .
"State: " . $_POST['sender_state'] . "\n\n" .
"Zip: " . $_POST['sender_zip'] . "\n" .
"More Info: " . $_POST['info'] . "\n" .
"\n--------------------------------------------------\n" .
"Message: " . $_POST['sender_message'] .
"\n--------------------------------------------------\n";
$header .= "From: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";
$header .= "Reply-To: " . $_POST['sender_name'] . " <" . $_POST['sender_mail'] . ">\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Priority: 1";
if(@mail($to, $subject, $body, $header))
{
echo "output=sent";
} else {
echo "output=error";
}
} else {
echo "output=error";
}
?>
I've also changed the ".=" to just "=" for the variable $body and the first $header variable. It didn't fix the problem, but I think that's the correct way to format the code. I'm still searching online for other clues.
error_reporting(E_ALL);
at the top of your code, and build a HTML form to post whatever your Flash app would post.
Also, have you verified that
mail()really works on the new server?
Also 2, your script is quite vulnerable to email header injection, as it doesn't sanitize user input. You might want to look into that...