note 58094 added to function.mail

From: Date: Mon, 24 Oct 2005 08:16:34 +0000
Subject: note 58094 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-97499@lists.php.net to get a copy of this message
I recently had an issue with this function where I was creating a message in the form: <?php $message = "blah"; $message .= "blah"; $message .= "blah"; $message .= "blah"; $message .= "blah"; ?> However, eventually the string $message ended up being more than 1000 characters long. I did not realise this was an issue and I have wasted 2 days of my life trying to figure out why a rogue "! " (exclamation mark + space) appeared in the middle of a word for litterally no reason. I did find out that if I inserted text before it, the problem shifted relatively as though it seemd to be "attached" to the beginging. The solution was to create a new line after every concatenation. This was suggested further down these notes - thanks!!! <?php $message = "blah\\n"; $message .= "blah\\n"; $message .= "blah\\n"; $message .= "blah\\n"; $message .= "blah\\n"; ?> To sum up, whenever you use the above method to create your message, ALWAYS put a "\\n" at the end of the line. Also try to keep the lines short. For example: It might take another 2 seconds to type the extra "\\n" in, but it would have saved me 2 days of my life (and a few clumps of hair too) ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58094 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58094&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58094&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97499) next »