SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy 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. =)

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try using filter_var instead
    coming soon sitejuju.com my new development portfolio

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!! =)

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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....s.sanitize.php
    coming soon sitejuju.com my new development portfolio

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •