Re: carriage returns in php mailer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux