#22812 [Opn->Bgs]: mail function adds additionas <> symbols to $to parameter

From: Date: Sun, 23 Mar 2003 03:25:04 +0000
Subject: #22812 [Opn->Bgs]: mail function adds additionas <> symbols to $to parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36206@lists.php.net to get a copy of this message
ID: 22812 Updated by: pollita@php.net Reported By: dbakr at evalica dot com -Status: Open +Status: Bogus Bug Type: Mail related Operating System: Windows XP PHP Version: 4.3.1 New Comment: 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()); Previous Comments: ------------------------------------------------------------------------ [2003-03-21 05:18:14] 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 :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22812&edit=1

« previous php.bugs (#36206) next »