Jump to content
xisto Community
Jonnyabc

Php Mail() Special Charaters How do I parce them correctly?

Recommended Posts

You make a website...so far so good. You create a feedback page...so far so good. You put a form on the page for users to submit responses back to. Only one problem, and I quote. Yes, the quotes, whether the single ' or the double " as well as the backslash \, these special characters don't \'appear\' "too\" well when they are received \\ read in an email.

I have already tried htmlentity() as follows:

$Message = htmlentities($_REQUEST["Message"]);

However, I still receive the incorrect characters. Mind you, I do not want to see " any more than I want to see \" (the latter being more acceptable of the two anyways). I just want to my email to come out correctly when it's sent.


There's probably an easy answer to it, but I'm too lazy at this point to try and mess with it any more.

Share this post


Link to post
Share on other sites

The htmlentities() function has a second parameter that allows you to pass a constant in specifically for quotes. Use ENT_NOQUOTES if you don't want both the single and double quotes to be converted to HTML entities.

 

On another note, if you are building this feedback form from scratch, be sure you have taken measures to prevent header injection. You normally don't have to worry about the body (in this case $Message), since it is always at the bottom.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.