scs Posted February 13, 2007 Share Posted February 13, 2007 Ok Im editing a really big script. An os-commerce. I added this plug-in for email and newsletter. When It sends an email It says that there is headers already sent by the email function. The reason I get that is the redirect function uses header("Loca..... ");. Well thats an easy fix, expect that I dont kno how to determine if a header is already sent. Do I just put the header function is a if statement? or is there a better way? Thanx in advance Zach Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/ Share on other sites More sharing options...
paul2463 Posted February 13, 2007 Share Posted February 13, 2007 the <?php header( 'Location: ../../../../blah.php); ?> code will only work if nothing else has been output to html, so if an echo statement or an error statment has been out put it will not work and tell you that the headers have already been sent Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-183999 Share on other sites More sharing options...
scs Posted February 13, 2007 Author Share Posted February 13, 2007 I kno that. I've ran into that problem before on my own scripts. but this is different. The only time the error shows up is when It use the mail() function. Well if there is an easy way to tell that headers have been sent, like from the mail function then I dont use the header function in the redrect script. Well with that said, would using the ob functions work with that. If I use the ob function will the emails not be sent? Zach Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-184008 Share on other sites More sharing options...
trq Posted February 13, 2007 Share Posted February 13, 2007 Can we see your code? Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-184014 Share on other sites More sharing options...
scs Posted February 13, 2007 Author Share Posted February 13, 2007 Ok, like I said its very big script. so Im just get the code that show up in the error. Here is the error first Warning: Cannot modify header information - headers already sent by (output started at \admin\includes\classes\email.php:520) in \admin\includes\functions\general.php on line 22 The email function if (EMAIL_TRANSPORT == 'smtp') { return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers)); <<<<<<Line 520 } else { return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers)); } The redirect function function tep_redirect($url) { global $logger; if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) { tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false)); } header('Location: ' . $url); <<<<<Line 22 if (STORE_PAGE_PARSE_TIME == 'true') { if (!is_object($logger)) $logger = new logger; $logger->timer_stop(); } exit; } Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-184024 Share on other sites More sharing options...
scs Posted February 14, 2007 Author Share Posted February 14, 2007 Ok I think this might accauly be the pronblem: Warning: mail() [function.mail]: SMTP server response: 550 Sender is not allowed. in \admin\includes\classes\email.php on line 522 With the same code above. And I just found out from that the server im working on is using php5. I normally use php4. So idk how that would change anything. Thanx Zach Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-184096 Share on other sites More sharing options...
scs Posted February 15, 2007 Author Share Posted February 15, 2007 Im in need of help. quick if posible. This error: SMTP server response: 550 Sender is not allowed. Does that mean that the host is not allowing the email to be sent. Cause I was able to send emails before this plug-in. Part of the code is above, which is the part with mail(). Im switching hosts right now. It could just be the host im on. It could be the code. If someone gots some testing tips to figure out whats going on that would be great. Thanx Zach Link to comment https://forums.phpfreaks.com/topic/38378-out-put-headers/#findComment-185111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.