phnxrecords Posted January 31, 2008 Share Posted January 31, 2008 i have some simple php being used to send emails from my website straight to me that had been working 100% fine before i changed one little thing--i recently bought a second domain to be used on the same hosting account as my previous domain, and now i am getting header errors in my php when the Submit button is pressed. i DID read the header sticky but don't quite understand what i am doing wrong as i am NOT a programmer at all. i also read in many places that the error could be caused by blank spaces which i checked and didn't find any. any help is appreciated, thank you so much. the mail does send successfully when the form is submitted but instead of being sent to the confirmation page, the following error is displayed to the user: Warning: Cannot modify header information - headers already sent by (output started at /home/viz0/public_html/label/contact/email.php:1) in /home/viz0/public_html/label/contact/email.php on line 12 <?php $name = $_POST['name']; $email = $_POST['email']; $reason = $_POST['reason']; $comments = $_POST['comments']; $subject = "PHNX Records message from: $name <$email>"; $headers = "From: $name <$email>"; $message = "From: ". $name ." <". $email .">.\r\n\r\n"; $message .= "Regarding: ". $reason ."\r\n\r\n"; $message .= "Comments: ". $comments ."\r\n"; mail("<omitted>",$subject,$message,$headers); header("Location: http://www.phnxrecords.com/contact/confirmation/"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/88687-solved-header-error-when-using-mail-function/ Share on other sites More sharing options...
rajivgonsalves Posted January 31, 2008 Share Posted January 31, 2008 there must be some whitespaces please read the Headers errors sticky on main forum it has all the information. Quote Link to comment https://forums.phpfreaks.com/topic/88687-solved-header-error-when-using-mail-function/#findComment-454169 Share on other sites More sharing options...
phnxrecords Posted January 31, 2008 Author Share Posted January 31, 2008 i already mentioned in the original post that i had already read the sticky and that i had already checked for white spaces. thank you anyway. Quote Link to comment https://forums.phpfreaks.com/topic/88687-solved-header-error-when-using-mail-function/#findComment-454176 Share on other sites More sharing options...
rajivgonsalves Posted January 31, 2008 Share Posted January 31, 2008 open your file and resave it, it must be a problem with file encoding Quote Link to comment https://forums.phpfreaks.com/topic/88687-solved-header-error-when-using-mail-function/#findComment-454177 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.