| 
 Posted by J.O. Aho on 11/24/05 02:34 
Stefan Mueller wrote: 
 
> But I still have the problem that I can't send a mail with the following  
> mail header: 
>   $headers = "MIME-Version: 1.0\n"; 
>   $headers .= "Content-type: text/html; charset=iso-8859-1\n"; 
>   $headers .= "From: \"User\" <user@inter.net>\n"; 
>  
> Therefore $headers is set to (echo $header;) 
>   MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 From: "User"  
> <user@inter.net> 
>  
> The mail has not been delivered and my PHP server says: 
>   [24-Nov-2005 00:37:19] PHP Warning:  mail() [<a  
> href='function.mail'>function.mail</a>]: SMTP server response: 501 5.5.4  
> Invalid Address in C:\PHP\file.php on line 132 
>  
>  
> If I use 
>   $headers .= "From: user@inter.net\n"; 
> instead of 
>   $headers .= "From: \"User\" <user@inter.net>\n"; 
> is works perfect. 
 
< and > is only used to display < and > on a HTML page and not in the 
From: or To: in mail(). 
 
so if you want to display the "header" variable and use it in your mail(), 
then you need to use a function like eregi_replace to transform the < and > to 
< and > if you want to display the whole string. 
 
 
 //Aho
 
[Back to original message] 
 |