Jump to content

[SOLVED] Unknown error : PHP5 seams to be unable to echo it all...


XRayden

Recommended Posts

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 info@xagone.com
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é"
info@xagone.com
emploisofferts@publicationweb.com[/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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.