mail() gives error: SMTP server response: 503 5.5.2 Need Rcpt command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • punitshrivastava
    New Member
    • Jul 2007
    • 22

    mail() gives error: SMTP server response: 503 5.5.2 Need Rcpt command

    Hi to All.
    I am Punit .I am back with new question .Please help me.
    I want to create one enquiry form in php.for this I code it:
    form code:
    [code=html]
    <form name="enquiry" method="post" action="enquiry .php">





    <table width="494" border="0" cellspacing="0" cellpadding="2" height="511">
    <tr>
    <td colspan="2" align="left" valign="top" height="29">
    <p align="left"><f ont face="Verdana" color="#FFFFFF" >Fields marked with * are mandatory
    </font></td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F" height="27">
    <font face="Verdana" size="2">Title *</font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F" height="27">
    <font face="Verdana" size="3">
    <select name="ddlTitle" id ="ddlTitle" size="1" style="border: 1px solid #315D10" tabindex="1">
    <option value="Mr">Mr</option>
    <option value="Mrs">Mrs </option>
    <option value="Ms">Ms</option>
    <option value="Miss">Mi ss</option>
    <option value="Dr">Dr</option>
    </select></font></td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F" height="25">
    <font face="Verdana" size="2"><label for="firstname" >First Name *</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F" height="25">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" name="txtFirstN ame" id ="txtFirstNa me" size="25" maxlength="30" style="border: 1px solid #315D10" tabindex="2"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="lastname"> Last Name *</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" name="txtLastNa me" id ="txtLastNam e" size="25" style="border: 1px solid #315D10" tabindex="3"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="postaladdr ess">Postal Address *</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <textarea name="txtPostal Address" id ="txtPostalAddr ess" cols="22" wrap="VIRTUAL" rows="3" style="border: 1px solid #315D10" tabindex="5"></textarea><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="town">Town </label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="3"><input type="text" name="txtTown" size="25" style="border: 1px solid #315D10" tabindex="6"></font></td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="pincode">P in code</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font size="2" face="Verdana">
    <input type="text" name="txtPinCod e" size="25" style="border: 1px solid #315D10" tabindex="7"></font></font></td>
    </tr>

    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="country">C ountry</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" id="country" name="txtCountr y" size="25" style="border: 1px solid #315D10" tabindex="8"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="telephone" >Telephone *</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" name="txtTeleph one" id ="txtTelepho ne" size="25" maxlength="14" style="border: 1px solid #315D10" tabindex="9"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="fax">Fax</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" name="txtFax" size="25" style="border: 1px solid #315D10" tabindex="10"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="email">E-mail
    *</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="text" name="txtEmail" id ="txtEmail" size="25" style="border: 1px solid #315D10" tabindex="11"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td align="left" bgcolor="#FFFFF F">
    <font face="Verdana" size="2"><label for="comments"> Your Enquiry</label></font></td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <textarea name="txtYourEn quiry" cols="30" rows="8" wrap="VIRTUAL" style="border: 1px solid #315D10" tabindex="12"></textarea></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFF F">&nbsp;</td>
    <td align="left" valign="top" bgcolor="#FFFFF F">&nbsp;</td>
    </tr>
    <tr>
    <td bgcolor="#FFFFF F">&nbsp;</td>
    <td align="left" valign="top" bgcolor="#FFFFF F">
    <font face="Verdana"> <font face="Verdana" size="3">
    <input type="submit" name="btnSubmit " value="Submit" style="border:1 px solid #315D10; " onclick = "return Validate();" tabindex="13"></font><font size="2"> &nbsp; &nbsp; &nbsp; &nbsp;



    </font><font face="Verdana" size="3">



    <input type="reset" name="btnReset" value="Reset" style="border: 1px solid #315D10" tabindex="14"></font><font size="2">
    </font></font>
    </td>
    </tr>
    <tr>
    <td bgcolor="#FFFFF F">&nbsp;</td>
    <td align="left" valign="top" bgcolor="#FFFFF F">&nbsp;
    </td>
    </tr>
    </table>
    </form>[/code]
    Coding for enquiry.php is:[code=php]
    <?php

    $Title = $_POST['ddlTitle'];

    $FirstName = $_POST['txtFirstName'];

    $LastName = $_POST['txtLastName'];

    $PostalAddress = $_POST['txtPostalAddre ss'];

    $Town = $_POST['txtTown'];

    $PinCode = $_POST['txtPinCode'];

    $Country = $_POST['txtCountry'];
    $Telephone = $_POST['txtTelephone'];
    $Fax = $_POST['txtFax'];
    $Email =$_POST['txtEmail'];

    $YourEnquiry = $_POST['txtYourEnquiry '];



    $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
    $mes= $mes & "<b>First Name:- </b>" & $FirstName & "<br>";
    $mes= $mes & "<b>Last Name:- </b>" & $LastName & "<br>";
    $mes= $mes & "<b>Postal Address:- </b>" & $PostalAddress & "<br>";

    $mes= $mes & "<b>Town:- </b>" & $Town & "<br>";

    $mes= $mes & "<b>Pin Code:- </b>" & $PinCode & "<br>";

    $mes= $mes & "<b>Country :- </b>" & $Country & "<br>";

    $mes= $mes & "<b>Telepho ne :- </b>" & $Telephone & "<br>";

    $mes= $mes & "<b>Fax :- </b>" & $Fax & "<br>";

    $mes= $mes & "<b>Email :- </b>" & $Email & "<br>";

    $mes= $mes & "<b>YourEnquiry :- </b>" & $YourEnquiry & "<br>";



    $header="from: $Email <$mail_from>" ;
    $Subject= 'enquiryform';
    $From = '$Email';
    $To= '__MUNGED__';
    $message = '$mes';
    $send_contact = mail($to,$subje ct,$message,$he ader);
    if($send_contac t)
    {
    echo "We've recived your contact information";
    }
    else
    {
    echo "ERROR";
    }
    ?>
    [/code]
    it is not executing.It gives warning:

    Warning: mail() [function.mail]: SMTP server response: 503 5.5.2 Need Rcpt command. in C:\Uniform3_1_1 s\www\abc\enqui ry.php on line 58
    ERROR
    Please suggest me what i do.As i am new in php so kindly suggest me wht i do.please help me.

    Thanks
    Punit Shrivastava
    Last edited by pbmods; Sep 22 '07, 01:16 PM. Reason: Added CODE tags.
  • etiainen
    New Member
    • Aug 2007
    • 40

    #2
    For start, please wrap the code in your post in [ PHP ] [ /PHP ] tags,
    i don't want to count the lines till line 58...

    Comment

    • punitshrivastava
      New Member
      • Jul 2007
      • 22

      #3
      Hi etiainen,
      i use the code for enquire form is:
      [php]
      <?php

      $Title = $_POST['ddlTitle'];

      $FirstName = $_POST['txtFirstName'];

      $LastName = $_POST['txtLastName'];

      $PostalAddress = $_POST['txtPostalAddre ss'];

      $Town = $_POST['txtTown'];

      $PinCode = $_POST['txtPinCode'];

      $Country = $_POST['txtCountry'];
      $Telephone = $_POST['txtTelephone'];
      $Fax = $_POST['txtFax'];
      $Email =$_POST['txtEmail'];

      $YourEnquiry = $_POST['txtYourEnquiry '];



      $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
      $mes= $mes & "<b>First Name:- </b>" & $FirstName & "<br>";
      $mes= $mes & "<b>Last Name:- </b>" & $LastName & "<br>";
      $mes= $mes & "<b>Postal Address:- </b>" & $PostalAddress & "<br>";

      $mes= $mes & "<b>Town:- </b>" & $Town & "<br>";

      $mes= $mes & "<b>Pin Code:- </b>" & $PinCode & "<br>";

      $mes= $mes & "<b>Country :- </b>" & $Country & "<br>";

      $mes= $mes & "<b>Telepho ne :- </b>" & $Telephone & "<br>";

      $mes= $mes & "<b>Fax :- </b>" & $Fax & "<br>";

      $mes= $mes & "<b>Email :- </b>" & $Email & "<br>";

      $mes= $mes & "<b>YourEnquiry :- </b>" & $YourEnquiry & "<br>";



      $header="from: $Email <$mail_from>" ;
      $Subject= 'enquiryform';
      $From = '$Email';
      $To= '__MUNGED__';
      $message = '$mes';
      $send_contact = mail($to,$subje ct,$message,$he ader);
      if($send_contac t)
      {
      echo "We've recived your contact information";
      }
      else
      {
      echo "ERROR";
      }
      ?>
      [/php]
      but this send error message & the message is:

      Warning: mail() [function.mail]: SMTP server response: 503 5.5.2 Need Rcpt command.
      Please suggest me what i do.
      Thanks & Regards.
      Punit Shrivastava
      Originally posted by etiainen
      For start, please wrap the code in your post in [ PHP ]
      [ /PHP ] tags,
      i don't want to count the lines till line 58...
      Last edited by pbmods; Sep 22 '07, 01:16 PM. Reason: Removed email address

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Punit.

        You define $To, but you use $to. In PHP, variable names are case-sensitive.

        Comment

        • karlectomy
          New Member
          • Sep 2007
          • 64

          #5
          i was just about to say that. Also check your other variables.....

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

            Comment

            • punitshrivastava
              New Member
              • Jul 2007
              • 22

              #7
              Hi pbmods,
              Thanks for valuable suggestion.
              Now i correct all the variable which i define in coding.it is not showing any error. but it is not working.means it is not showing error but not sending mail.please suggest me. what i do.please
              Thanks & Regards
              Punit Shrivastava
              Originally posted by pbmods
              Heya, Punit.

              You define $To, but you use $to. In PHP, variable names are case-sensitive.

              Comment

              • pbmods
                Recognized Expert Expert
                • Apr 2007
                • 5821

                #8
                Heya, Punit.

                In your code:
                [code=php]
                $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
                [/code]

                In PHP, '&' is a bitwise operator, which will give very different results than what you're trying to accomplish.

                You probably meant to do this:
                [code=php]
                $mes .= '<b>Title:- </b>' . $Title . '<br />';
                [/code]

                I don't know why anybody uses ASP anymore....

                Comment

                • punitshrivastava
                  New Member
                  • Jul 2007
                  • 22

                  #9
                  Hi pbmods,
                  Thanks for giving me valuable suggestion .But it is not sending mail.Is there any setup which i have to create for SMTP server .Because it is not showing any error but it is not working .Please suggest me what i do.
                  Thanks
                  Punit Shrivastava
                  Originally posted by pbmods
                  Heya, Punit.

                  In your code:
                  [code=php]
                  $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
                  [/code]

                  In PHP, '&' is a bitwise operator, which will give very different results than what you're trying to accomplish.

                  You probably meant to do this:
                  [code=php]
                  $mes .= '<b>Title:- </b>' . $Title . '<br />';
                  [/code]

                  I don't know why anybody uses ASP anymore....

                  Comment

                  Working...