#22812 [Com]: mail function adds additionas <> symbols to $to parameter

From: Date: Sun, 22 Jun 2003 04:49:57 +0000
Subject: #22812 [Com]: mail function adds additionas <> symbols to $to parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42322@lists.php.net to get a copy of this message
ID: 22812 Comment by: bobe at phpcodeur dot net Reported By: dbakr at evalica dot com Status: Bogus Bug Type: Mail related Operating System: Windows XP PHP Version: 4.3.1 New Comment: This tips provokes a problem on the Linux servers, the email is twice received On Linux, if we put nothing for the first argument of the mail() function and what we add to in headers them, the email is correctly received (And a to header empty is added all the same), but it plants under Windows (SMTP error 554) So, on the Windows servers, this tips works perfectly. Then ? Bug or not bug ? :) Previous Comments: ------------------------------------------------------------------------ [2003-03-22 21:25:03] pollita@php.net 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()); ------------------------------------------------------------------------ [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 (#42322) next »