Warning: mail() [function.mail]: SMTP server response: 503 valid RCPT command must pr

Discussion in 'PHP' started by macaela, Apr 22, 2010.

  1. #1
    Warning: mail() [function.mail]: SMTP server response: 503 valid RCPT command must precede DATA on

    whenever user click on to get new password but doesnt fill in the username field it shows that message i have set up the server because if user put username the form works but if left blanck this error message keeps coming up


    
     function procForgotPass(){
    
          global $database, $session, $mailer, $form;
    
          /* Username error checking */
    
          $subuser = $_POST['user'];
    
          $field = "user";  //Use field name for username
    
          if(!$subuser || strlen($subuser = trim($subuser)) == 0){
    
             $form->setError($field, "* Username not entered<br>");
    
          }
    
          else{
    
             /* Make sure username is in database */
    
             $subuser = stripslashes($subuser);
    
             if(strlen($subuser) < 5 || strlen($subuser) > 30 ||
    
                !eregi("^([0-9a-z])+$", $subuser) ||
    
                (!$database->usernameTaken($subuser))){
    
                $form->setError($field, "* Username does not exist<br>");
    
             }
    
          }
    
          
          /* Errors exist, have user correct them */
    
          if($form->num_errors > 0){
    
             $_SESSION['value_array'] = $_POST;
    
             $_SESSION['error_array'] = $form->getErrorArray();
    
          }    
    
          /* Generate new password and email it to user */
    
          else
    
          // make sure seesion starts before
    
          header("Location: ".$session->referrer);
    
          
    
          {
    
             /* Generate new password */
    
             $newpass = $session->generateRandStr(8);
    
             
    
             /* Get email of user */
    
             $usrinf = $database->getUserInfo($subuser);
    
             $email  = $usrinf['email'];
    
             
    
             /* Attempt to send the email with new password */
    
             if($mailer->sendNewPass($subuser,$email,$newpass)){
    
                /* Email sent, update database */
    
                $database->updateUserField($subuser, "password", md5($newpass));
    
                $_SESSION['forgotpass'] = true;
    
             }
    
             /* Email failure, do not change password */
    
             else{
    
                $_SESSION['forgotpass'] = false;
    
             }
    
          }
    
          
    
          
    
       } 
    
    
    PHP:
    this is my mail set



    
     function sendNewPass($user, $email, $pass){
    
          $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
    
          $subject = "Elite ticket master - Your new password";
    
          $body = $user.",\n\n"
    
                 ."We've generated a new password for you at your "
    
                 ."request, you can use this new password with your "
    
                 ."username to log in to Eliteticketsevents Site.\n\n"
    
                 ."Username: ".$user."\n"
    
                 ."New Password: ".$pass."\n\n"
    
                 ."It is recommended that you change your password "
    
                 ."to something that is easier to remember, which "
    
                 ."can be done by going to the My Account page "
    
                 ."after signing in.\n\n"
    
                 ."- EliteTickets's Site";
    
                 
    
         
    
                  $server = "smtp.virgin.net";
    
     ini_set("SMTP",$server);
    
     
    
     
    
    
    
           return mail($email,$subject,$body,$from);
    PHP:
     
    macaela, Apr 22, 2010 IP