Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts

    htmlspecialchars for email content

    hi all

    I have this below code for <textarea> in which person enters his enquiry

    PHP Code:
    $body="Hi \n<br><br>".htmlspecialchars($name). " had sent you enquiry . ".  " \n<br><br>
    Person Enquiry = "
    htmlspecialchars($enquiry) . " \n<br><br> "
    mail($to,$body); 
    after person enters enquiry the email is sent with the enquiry entered.

    i receive enquiry content as

    Code:
    yo man\r\n\r\ntesting new site\r\n\r\nstay tuned\r\n\r\nvineet
    how can i use htmlspecialchars in the way it doesnt echoes \r\n\r\

    vineet

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Well those characters wouldn't be visible in an HTML email and you shouldn't be using htmlspecialchars for a plain text email so presumably the solution is to get rud of the htmlspecialchars call that shouldn't be there so as to allow the plain text to display properly in the email.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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