SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Mail and PHP

  1. #1
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi. I'm having problems sending mail using PHP. I have a form in a regular HTML file, and it contains just a TEXTAREA field, the value of which is submitted to the PHP file/script to be e-mailed. When I receive the e-mail, some characters have been "escaped", and there are extra lines. For example, if I enter the following in the TEXTAREA box:

    Hi, it's January

    It's cold

    The resulting e-mail displays the following:

    Hi, it\'s January



    It\'s cold

    (That should be a backslash before each apostrophe... just in case the forum script messes with it!)

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just use $var = stripslashes($var); Before using it in the mail command
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Somehow I knew you'd be there to answer. :-) That works great for the slashes. THANK YOU. Any ideas on the extra lines? If I do

    Red
    Blue
    Green

    I instead get

    Red

    Blue

    Green

    THANKS again.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $str = ereg_replace("\\n", "", $str);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you once again. Just so you know, the program only wanted one backslash before the letter 'n'. When I used two backslashes, my e-mail arrived with no n's in it! It made for some interesting reading. :-)

    I appreciate the help.

  6. #6
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ooops!
    <Edited by firepages on 01-14-2001 at 12:04 AM>


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
  •