500 Internal Server Error
-
On my WordPress site i have a contact form so users can email me. When ever I hit the submit button I get a 500 Internal Server Error message; however, the email still goes through. My error logs gives me this message:
[Sat Jun 12 23:32:45 2010] [error] [client] malformed header from script. Bad header=/home/content/a/b/a/name/d: /var/chroot/home/content/a/b/a/name/html/wp-content/themes/brave-zeenat/contact.php.
The code for contact.php is below. Can anyone help me?
<?php
$to = $_REQUEST[‘sendto’] ;
$from = $_REQUEST[‘Email’] ;
$name = $_REQUEST[‘Name’] ;
$headers = “From: $from”;
$subject = “Email from Website”;$fields = array();
$fields{“Name”} = “Name”;
$fields{“Email”} = “Email”;
$fields{“Website”} = “Website”;
$fields{“Message”} = “Message”;$body = “You have received the following information from your website:\n\n”; foreach($fields as $a => $b){ $body .= sprintf(“%20s: %s\n”,$b,$_REQUEST[$a]); }
$headers2 = “From: [email protected]”;
$subject2 = “Thank you for contacting me”;
$autoreply = “Thank you for contacting me. I will get back to you as soon as possible, usually within 48 hours. If you have any more questions, please consult my website at https://www.website.com”;if($from == ”) {print “You have not entered an email, please go back and try again”;}
else {
if($name == ”) {print “You have not entered a name, please go back and try again”;}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( “Location: https://www.website.com/” );}
else
{print “We encountered an error sending your mail, please notify [email protected]”; }
}
}
?>
- The topic ‘500 Internal Server Error’ is closed to new replies.