send php mail with spaces in subject

Discussion in 'PHP' started by phantom, Mar 19, 2012.

  1. #1
    I am sending mail using php mail function with a subject like 'my subject' but it doesn't work until I replace the space like 'my_subject"


    Does anyone know why that would be?
     
    phantom, Mar 19, 2012 IP
  2. Arttu

    Arttu Member

    Messages:
    139
    Likes Received:
    2
    Best Answers:
    8
    Trophy Points:
    40
    #2
    It should work with spaces in subject. Are you sure that that's the problem?
     
    Arttu, Mar 19, 2012 IP
  3. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #3
    I have sent with spaces before so I know it works but in this case it wont

    The above only works if I take the spaces out of the subject......I don't get it:(
     
    phantom, Mar 19, 2012 IP
  4. samyak

    samyak Active Member

    Messages:
    280
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    90
    #4
    Remove the headers and try to send plain text mail. See if that works. The charset you specified may be causing the problem.
     
    samyak, Mar 19, 2012 IP
  5. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #5
    I already tried as plain text too and that didn't work.
     
    phantom, Mar 19, 2012 IP
  6. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #6
    Grit., Mar 23, 2012 IP
  7. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #7
    I finally got it to work. The problem was I was putting in \n and ' in the the body of the message . Somehow and I don't know why but if there were spaces in the subject with those in the body it would not work. I have since moved to using the phpmailer class.
     
    phantom, Mar 23, 2012 IP
  8. peoplesinnovation1

    peoplesinnovation1 Greenhorn

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #8
    It should work with spaces in subject.
     
    peoplesinnovation1, Mar 28, 2012 IP
  9. seopush

    seopush Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I think you should try using single quote instead of double quote in most of the cases it doesnt require something special to add space between the variable values
     
    seopush, Mar 28, 2012 IP