Reply to Re: [PHP] carriage returns in php mailer

Your name:

Reply:


Posted by Richard Lynch on 05/13/05 02:36

On Thu, May 12, 2005 2:40 am, Ross said:
> http://scottishsocialnetworks.org/mailer.phps
>
> I have a php mailer that takes in some text from a text box and puts in in
> an email. The problem is the body text is assigned to a variable to be put
> in the email but it does not pick up the returns.

The returns could come from a Windows browser (\r\n) or a Mac browser (\r)
or a Linux browser (\n)

You first need to get them to all be the "same":

$body = str_replace("\r\n", "\n", $body);
$body = str_replace("\r", "\n", $body);
//Note that the order of the two statements is crucial

//You now have all Linux (\n) newlines.

If you are using Linux for your outgoing mail server, you are done.

If you are using Windows for your mail server, you probably need \r\n for
outgoing email:
$body = str_replace("\n", "\r\n", $body);

If you are using Mac, you probably need \r:
$body = str_replace("\n", "\r", $body);


Aside:
Some days I just wanna shoot the guys who made up these different newline
formats...

--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация