XRayden Posted January 10, 2007 Share Posted January 10, 2007 hello...i've got a php class to validate form intry, it's supposed to send back the result in an email.so far was working good, now i've got it to work on a PHP5 environment and it works, partialy... here the error : the faulty code reside in my html_mail() function : [code]function html_mail() { $this->headers = "MIME-Version: 1.0\n"; $this->headers .= "Content-type: text/html; charset=iso-8859-1\n"; $this->headers .= "X-Priority: 3\n"; $this->headers .= "X-MSMail-Priority: Normal\n"; $this->headers .= "X-Mailer: php\n"; $this->headers .= "From: \"".$this->fromname."\" <".$this->fromaddress.">\n"; return mail($this->to, $this->subject, stripslashes($this->message), $this->headers); }[/code]it was causing RANDOM unknown... it works perfectly if my $this->to variable is set to [email protected]and seams to NOT WORK if it's anything other than this one... but here comes the part that thrown me out of my chair. it's not the $this->to that cauze the error!check this out : i've modified the code to output some elements[code]function html_mail() { $this->headers = "MIME-Version: 1.0\n"; $this->headers .= "Content-type: text/html; charset=iso-8859-1\n"; $this->headers .= "X-Priority: 3\n"; $this->headers .= "X-MSMail-Priority: Normal\n"; $this->headers .= "X-Mailer: php\n"; echo $this->headers .= "From: \"".$this->fromname."\" <".$this->fromaddress.">\n"; echo '<br />'; echo $this->fromaddress; echo '<br />'; echo $this->to; return mail($this->to, $this->subject, stripslashes($this->message), $this->headers); }[/code]here is the output : [code]MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: php From: "Olivier Labbé"[email protected][email protected][/code]php5 seams to shit the line :$this->headers .= "From: \"".$this->fromname."\" <".$this->fromaddress.">\n";and not being able to output the first "<" ... i've tried escaping it... dont work... any idea ? Link to comment https://forums.phpfreaks.com/topic/33602-solved-unknown-error-php5-seams-to-be-unable-to-echo-it-all/ Share on other sites More sharing options...
trq Posted January 10, 2007 Share Posted January 10, 2007 To keep it simple, try....[code=php:0]$this->headers .= "From: \"{$this->fromname}\" <{$this->fromaddress>}\n";[/code] Link to comment https://forums.phpfreaks.com/topic/33602-solved-unknown-error-php5-seams-to-be-unable-to-echo-it-all/#findComment-157468 Share on other sites More sharing options...
XRayden Posted January 10, 2007 Author Share Posted January 10, 2007 still doesn't work... is there a way to know WHY the mail() is returning false ? Link to comment https://forums.phpfreaks.com/topic/33602-solved-unknown-error-php5-seams-to-be-unable-to-echo-it-all/#findComment-157527 Share on other sites More sharing options...
emehrkay Posted January 10, 2007 Share Posted January 10, 2007 why are you setting the headers var as a property of the class? will you use it somewhere else in the class? if not just do $header = ...that may cause your problem Link to comment https://forums.phpfreaks.com/topic/33602-solved-unknown-error-php5-seams-to-be-unable-to-echo-it-all/#findComment-157573 Share on other sites More sharing options...
kenrbnsn Posted January 10, 2007 Share Posted January 10, 2007 As for PHP loosing the opening "<" in the echo statement. If you look at the source of the web page, you will see the character there. The problem is that the browser is eating it thinking that it is the beginning of a tag. To solve this problem, use the htmlentities() function when echoing the variable.Ken Link to comment https://forums.phpfreaks.com/topic/33602-solved-unknown-error-php5-seams-to-be-unable-to-echo-it-all/#findComment-157588 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.