using the mail function in php


I am still very new to php and I am trying to get my head around the mail

If I set the content type to html (Content-type: text/html;
charset=iso-8859-1) I can do basic html.

However if I have any html that requires quotes (eg hrefs) the function will
escape the quotes resulting in html with backslashes through it.

eg. I submit the following using POST from a form to the message variable:

<html><head<title>page title</title>
<img src="" border="0" width="300" height="200" alt="">

I get this:

<html><head<title>page title</title>
<img src="" border="0"
width="300" height="200" alt="">

Any ideas?



Simply use stripslashes on the text coming from the form. It simply a security configuration in PHP that escapes all quotes as a default value to avoid most SQL injection attacks and such.


Thanks for that help.

I didn’t figure I needed to stripslashes when there weren’t any there.

But the other piece of the puzzle was that I had used the example of some other code and had included a header:
Content-Transfer-Encoding: quoted-printable

When changing the Content-type to text/html that line needs to be removed.