Sending php mail() from a web textbox

Hey all,

I have a somewhat frustrating issue.

Im have a web database where the administrator can sends users emails from an html form with textbox for the messge.

I cant seem to get rid of some errors.

I use mysql_real_escape_string to sanitize the message, however this leaves me with backslashes in my message( before apostrophes and such).

If i remove slashes, the admins line breaks insert “rn” on each line break in the message.

Is there a possible way to simply send php mail cleanly, without apostrophes cutting the message off, without backslashes for characters, and without inserting "rn"s for the line breaks.

Ive looked all over but every solution leads to a new problem.

Thanks for any help anyone could give me. =)

try using filter_var instead

Hmm… not trying to validate the email address, thats not an issue. Just trying to send the message as it was typed by the email sender (with apostrophes, line breaks, any and all characters). Cant seem to find a catch all solution that will allow the person to type out a message in a textbox and send as email in the same format.

Ideally something that encases the message and sends it exactly as it was typed without characters inside the message messing things up.

Unless im not understanding how to use filter_var in this instance.

Thanks for your reply nonetheless!! =)

Yes filter_var can validate an email for you but its not the only thing its good for. “filter_var(‘your message’, FILTER_SANITIZE_STRING);” But take a look at the sanitize filters for filter_var they should help you. http://www.php.net/manual/en/filter.filters.sanitize.php

Thank you, I will try this out and see if I cant customize this function/my code to fix my problems. May the rest of your day be wonderful.