I am sure you all know this error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/4/d374499247/htdocs/wp-content/themes/tyler/mail.php:1) in /homepages/4/d374499247/htdocs/wp-content/themes/tyler/mail.php on line 34
And this is the code:
if (strpos($email,'@') !== false) {
ob_start();
mail($to,$subject,$message,$headers);
header("Location: thankyou.html");
ob_end_flush(); }
Could anyone offer any help here? I just want it to mail() the information and then go to the Location page
EDIT: Here is the entire code..
<?php
$to = 'myemail@gmail.com';
$subject = 'בקשת הצטרפות לרשימת תפוצה';
$message =
'בקשת הצטרפות לרשימת תפוצה' . "\n\n" .
'שם: ' . $_REQUEST['name'] . "\n\n" .
'דואר אלקטרוני: ' . $_REQUEST['email'];
$email = $_REQUEST['email'];
$headers = 'From: ' . $email . "\r\n" .
'Reply-To: ' . $email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/plain; charset=ISO-8859-1";
// server-validation
if (strpos($email,'@') !== false){
mail($to,$subject,$message,$headers);
header("Location: thankyou.html");
} else {
echo "<p class='error'>כתובת הדוא'ל שגויה.</p>";
}
?>