>Hi guys, > >Am writing a web based mailclient (obviously with PHP+IMAP), >In the 'ReplyMail' script, inorder to add the "> " string >at the beginning of everyline, I used the following code, ><? >$replymessage = $replymessage.str_replace("\n", "\n> ", >htmlspecialchars(trim(imap_body($mbox, $msg)))); >?> > >This is giving an output with one additional \n in the TEXTAREA, >like below
Maybe put the trim() "outside" the str_replace()... Also be sure you don't have a hard-coded newline in your HTML/PHP source inside the <TEXTAREA></TEXTAREA> tags. I also would use htmlentities() rather than htmlspecialchars() personally... Probably arguable what's "right" You may also be the victim of Windoze/Unix/Macintosh newline issues. Perhaps try: # Convert Windows to Unix: $msg = str_replace("\r\n", "\n", $msg); # Convert Mac to Unix: $msg = str_replace("\r", "\n", $msg); before you do the "\n> " part. You may also wish to consider using textwrap (wraptext?) before you do the "\n> " part, since some people's mailers will not wrap outgoing text. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php