original_string: protected function login()
      {
          if ( $this->doAuthenticate )
          {
              $this->sendData( 'EHLO ' . $this->senderHost );
          }
          else
          {
              $this->sendData( 'HELO ' . $this->senderHost );
          }
  
          if ( $this->getReplyCode( $response ) !== '250' )
          {
              throw new ezcMailTransportSmtpException( "HELO/EHLO failed with error: {$response}." );
          }
  
          // do authentication
          if ( $this->doAuthenticate )
          {
              if ( $this->options->preferredAuthMethod !== self::AUTH_AUTO )
              {
                  $this->auth( $this->options->preferredAuthMethod );
              }
              else
              {
                  preg_match( "/250-AUTH[= ](.*)/", $response, $matches );
                  if ( count( $matches ) > 0 )
                  {
                      $methods = explode( ' ', trim( $matches[1] ) );
                  }
                  if ( count( $matches ) === 0 || count( $methods ) === 0 )
                  {
                      throw new ezcMailTransportSmtpException( 'SMTP server does not accept the AUTH command.' );
                  }
  
                  $authenticated = false;
                  $methods = $this->sortAuthMethods( $methods );
                  foreach ( $methods as $method )
                  {
                      if ( $this->auth( $method ) === true )
                      {
                          $authenticated = true;
                          break;
                      }
                  }
  
                  if ( $authenticated === false )
                  {
                      throw new ezcMailTransportSmtpException( 'SMTP server did not respond correctly to any of the authentication methods ' . implode( ', ', $methods ) . '.' );
                  }
              }
          }
          $this->status = self::STATUS_AUTHENTICATED;
      }
code: protected function login()
      {
          if ( $this->doAuthenticate )
          {
              $this->sendData( 'EHLO ' . $this->senderHost );
          }
          else
          {
              $this->sendData( 'HELO ' . $this->senderHost );
          }
  
          if ( $this->getReplyCode( $response ) !== '250' )
          {
              throw new ezcMailTransportSmtpException( "HELO/EHLO failed with error: {$response}." );
          }
  
          // do authentication
          if ( $this->doAuthenticate )
          {
              if ( $this->options->preferredAuthMethod !== self::AUTH_AUTO )
              {
                  $this->auth( $this->options->preferredAuthMethod );
              }
              else
              {
                  preg_match( "/250-AUTH[= ](.*)/", $response, $matches );
                  if ( count( $matches ) > 0 )
                  {
                      $methods = explode( ' ', trim( $matches[1] ) );
                  }
                  if ( count( $matches ) === 0 || count( $methods ) === 0 )
                  {
                      throw new ezcMailTransportSmtpException( 'SMTP server does not accept the AUTH command.' );
                  }
  
                  $authenticated = false;
                  $methods = $this->sortAuthMethods( $methods );
                  foreach ( $methods as $method )
                  {
                      if ( $this->auth( $method ) === true )
                      {
                          $authenticated = true;
                          break;
                      }
                  }
  
                  if ( $authenticated === false )
                  {
                      throw new ezcMailTransportSmtpException( 'SMTP server did not respond correctly to any of the authentication methods ' . implode( ', ', $methods ) . '.' );
                  }
              }
          }
          $this->status = self::STATUS_AUTHENTICATED;
      }
code_tokens: protected function login ( ) { if ( $ this -> doAuthenticate ) { $ this -> sendData ( 'EHLO ' . $ this -> senderHost ) ; } else { $ this -> sendData ( 'HELO ' . $ this -> senderHost ) ; } if ( $ this -> getReplyCode ( $ response ) !== '250' ) { throw new ezcMailTransportSmtpException ( "HELO/EHLO failed with error: {$response}." ) ; } // do authentication if ( $ this -> doAuthenticate ) { if ( $ this -> options -> preferredAuthMethod !== self :: AUTH_AUTO ) { $ this -> auth ( $ this -> options -> preferredAuthMethod ) ; } else { preg_match ( "/250-AUTH[= ](.*)/" , $ response , $ matches ) ; if ( count ( $ matches ) > 0 ) { $ methods = explode ( ' ' , trim ( $ matches [ 1 ] ) ) ; } if ( count ( $ matches ) === 0 || count ( $ methods ) === 0 ) { throw new ezcMailTransportSmtpException ( 'SMTP server does not accept the AUTH command.' ) ; } $ authenticated = false ; $ methods = $ this -> sortAuthMethods ( $ methods ) ; foreach ( $ methods as $ method ) { if ( $ this -> auth ( $ method ) === true ) { $ authenticated = true ; break ; } } if ( $ authenticated === false ) { throw new ezcMailTransportSmtpException ( 'SMTP server did not respond correctly to any of the authentication methods ' . implode ( ', ' , $ methods ) . '.' ) ; } } } $ this -> status = self :: STATUS_AUTHENTICATED ; }
docstring: Performs the initial handshake with the SMTP server and
  authenticates the user, if login data is provided to the
  constructor.
  
  @throws ezcMailTransportSmtpException
  if the HELO/EHLO command or authentication fails
docstring_tokens: Performs the initial handshake with the SMTP server and authenticates the user if login data is provided to the constructor .