note 19373 added to function.mail

From: Date: Mon, 25 Feb 2002 23:42:00 +0000
Subject: note 19373 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-27036@lists.php.net to get a copy of this message
Watch out for subject lines with a \n at the end (or presumably anywhere). mail() won't strip this off the end and any additional headers specified in the fourth parameter will get stuck at the beginning of the body. Exmaple: mail("joe@php.net", "Registration Confirmation\n", "This is to confirm your registration... blah...", "From: registration@php.net"); Sends a message to joe@php.net with a subject of "Registration Confirmation" as expected, but shows the userid of the process running the web server as the sender and has the following as a body: --------------------------------- From: registration@php.net This is to confirm your registration...blah... --------------------------------- a quick "trim($subject)" solves this. -- http://www.php.net/manual/en/function.mail.php http://master.php.net/manage/user-notes.php?action=edit+19373 http://master.php.net/manage/user-notes.php?action=delete+19373 http://master.php.net/manage/user-notes.php?action=reject+19373

« previous php.notes (#27036) next »