|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-21 05:18 UTC] dbakr at evalica dot com
mail("Danya <dbakr@evalica.com>", "the subject", "test",
"From: webmaster@$SERVER_NAME\r\n"
."Reply-To: webmaster@$SERVER_NAME\r\n"
."X-Mailer: PHP/" . phpversion());
results of running scripts
Warning: mail() [function.mail]: SMTP server response: 501 >: "@" or "." expected after "Danya" in c:\app\apache\html\smail\test.php on line 6
this error message caused by mail() function's adding additional <> symbols to "Danya <dbakr@evalica.com>".
resulting email addres that was sended to smtp server was "<Danya <dbakr@evalica.com>>". Of course, server generates error :)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 11:00:01 2025 UTC |
The first parameter to mail() should *only* be the email address itself. This is the documented and expected behavior for mail(). If you're curious why this is, I invite you to read the RFC relating to the SMTP protocol. If you would like to make sure your header contains the correct real name description put a "To:" header in the fourth parameter. mail("dbakr@evalica.com", "the subject", "test", "To: Danya <dbakr@evalica.com>\r\n" ."From: webmaster@$SERVER_NAME\r\n" ."Reply-To: webmaster@$SERVER_NAME\r\n" ."X-Mailer: PHP/" . phpversion());