Re: What's the trick ?

From: Date: Mon, 26 Aug 2002 22:56:52 +0000
Subject: Re: What's the trick ?
Groups: php.general 
Request: Send a blank email to php-general+get-114191@lists.php.net to get a copy of this message
>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

« previous php.general (#114191) next »