Reply to Re: Why can't I create the string "User" <user@inter.net>

Your name:

Reply:


Posted by Stefan Mueller on 11/24/05 02:15

> Your original code snippet was:
>
>> <?php
>> $name = "User";
>> $email = "user@inter.net";
>> $header = "From: \"$name\" <$email>";
>> echo $header;
>> ?>

Yea, you're right. Because
echo $header
didn't show what I expected. But I do have mail() in my PHP part.

But you're right again. If I put mail() within the same PHP part I don't
have the problem we are talking about. It's a different one. I experience
this problem only if I use
echo $header

Great, now I understand what's going on and now I understand why in all
other PHP pages they use
$headers .= 'From: "User" <user@inter.net>' . "\r\n";
They just do mail() and not echo.

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\" &lt;user@inter.net&gt;\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\" &lt;user@inter.net&gt;\n";
is works perfect.

What's wrong?
I'm really loosing the hope.
Stefan

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация