• Resolved Oztac

    (@oztac)


    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/&#8221; );}
    else
    {print “We encountered an error sending your mail, please notify [email protected]”; }
    }
    }
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here is a 2 mins check :

    Install the plugin : Contact Form 7
    It has an inbuilt form and uses the same mail() function. Send a test email using the same. If it gives the same error then contact your webhost if not then your script is faulty.

    Hope this helps

    Thread Starter Oztac

    (@oztac)

    Thanks, that plugin worked. I think I will just switch to using it instead.

    Great!

    Cheers

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘500 Internal Server Error’ is closed to new replies.