Jump to content

nl2br($string) vs. str_replace("\n","<br />","$string"); before using mail();


sKunKbad

Recommended Posts

I've got a script that sends mail based on quiz answers that are stored in an xml file. The answers have \n newline characters in them, which I convert to

<br />

before generating the HTML portion of a multipart email. I was experiencing problems using str_replace to replace all of the \n with

<br />

, but nl2br works fine. What is strange is, when using str_replace, I can check the value of the converted string with echo and it looks just as I want, but the mail() function won't accept the string, and mail() fails. Using nl2br works great. I just want to know why the string generated by str_replace isn't accepted by the mail function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.