php mail function error...

Discussion in 'PHP' started by rsmaha, Sep 29, 2009.

  1. #1
    Hi All,

    Im using
    mail($to,$subject,$message,$headers);
    function to send mail. its already uploaded to server. if i execute this file im getting following error:


    Warning: mail() [function.mail]: SMTP server response: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it in C:\Inetpub\vhosts\XXX.in\httpdocs\YYY\signup_success.php on line 159

    what is this error? Whether i i want to includu any file? (like ini file)

    Help!!!
     
    rsmaha, Sep 29, 2009 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Well... you haven't included the code for the signup_success.php, so it's hard to say, but my guess would be that you assign the $to-variable somewhere near line 159 in that file (or use it) - and that it is empty - the error sounds to me like you're trying to send the email to no receipients - ie, the $to-variable is empty.

    Try echoing out the different variables before using the mail()-function, to see what they contain.
     
    PoPSiCLe, Sep 29, 2009 IP
  3. rsmaha

    rsmaha Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya got it.. thank you..

    But there is another probem...
    in my inbox , instead of msg im getting some other that is ,

    Message-ID: <FC023E80C237463FBEA43F436CC8EBA9.MAI@home>

    but i have declared some other in body...

    suggest!!!
     
    rsmaha, Sep 30, 2009 IP
  4. Gray Fox

    Gray Fox Well-Known Member

    Messages:
    196
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Are you sure you are sending correct headers and the message body? Headers should look somewhat like this
    
    MIME-Version: 1.0
    Date: Wed, 30 Sep 2009 01:17:05 -0400
    Return-Path: webmaster@domain.com
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Mailer: PHP Mailer
    From: "webmaster" <webmaster@domain.com>
    Content-type: text/plain; charset="utf-8"
    
    Code (markup):
     
    Gray Fox, Sep 30, 2009 IP
  5. rsmaha

    rsmaha Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry ,

    Its my mistake. I missed headers.. thanks..
     
    rsmaha, Sep 30, 2009 IP
  6. sudeep333

    sudeep333 Peon

    Messages:
    321
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Proper Header is very much required while using such functions.
     
    sudeep333, Oct 1, 2009 IP
  7. rsmaha

    rsmaha Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    hi all,

    How to auto submit the page after 5 sec? any one!!!
     
    rsmaha, Oct 2, 2009 IP
  8. racklane

    racklane Peon

    Messages:
    98
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Dont make the address $to, it has to be $recipient
     
    racklane, Oct 3, 2009 IP
  9. lmao

    lmao Guest

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    well in js you can use settimeout method
     
    lmao, Oct 3, 2009 IP