lib/classes/Swift/Transport/Esmtp/AuthHandler.php
public function afterEhlo(Swift_Transport_SmtpAgent $agent)
    {
        if ($this->username) {
            $count = 0;
            $errors = [];
            foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
                if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->esmtpParams))) {
                    ++$count;
                    try {
                        if ($authenticator->authenticate($agent, $this->username, $this->password)) {
                            return;
                        }
                    } catch (Swift_TransportException $e) {
                        // keep the error message, but tries the other authenticators
                        $errors[] = [$authenticator->getAuthKeyword(), $e->getMessage()];
                    }
                }
            }

            $message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
            foreach ($errors as $error) {
                $message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
            }
            throw new Swift_TransportException($message);
        }
    }
public function afterEhlo(Swift_Transport_SmtpAgent $agent)
    {
        if ($this->username) {
            $count = 0;
            $errors = [];
            foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
                if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->esmtpParams))) {
                    ++$count;
                    try {
                        if ($authenticator->authenticate($agent, $this->username, $this->password)) {
                            return;
                        }
                    } catch (Swift_TransportException $e) {
                        // keep the error message, but tries the other authenticators
                        $errors[] = [$authenticator->getAuthKeyword(), $e->getMessage()];
                    }
                }
            }

            $message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
            foreach ($errors as $error) {
                $message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
            }
            throw new Swift_TransportException($message);
        }
    }
public function afterEhlo ( Swift_Transport_SmtpAgent $ agent ) { if ( $ this -> username ) { $ count = 0 ; $ errors = [ ] ; foreach ( $ this -> getAuthenticatorsForAgent ( ) as $ authenticator ) { if ( in_array ( strtolower ( $ authenticator -> getAuthKeyword ( ) ) , array_map ( 'strtolower' , $ this -> esmtpParams ) ) ) { ++ $ count ; try { if ( $ authenticator -> authenticate ( $ agent , $ this -> username , $ this -> password ) ) { return ; } } catch ( Swift_TransportException $ e ) { // keep the error message, but tries the other authenticators $ errors [ ] = [ $ authenticator -> getAuthKeyword ( ) , $ e -> getMessage ( ) ] ; } } } $ message = 'Failed to authenticate on SMTP server with username "' . $ this -> username . '" using ' . $ count . ' possible authenticators.' ; foreach ( $ errors as $ error ) { $ message .= ' Authenticator ' . $ error [ 0 ] . ' returned ' . $ error [ 1 ] . '.' ; } throw new Swift_TransportException ( $ message ) ; } }
Runs immediately after a EHLO has been issued.

@param Swift_Transport_SmtpAgent $agent to read/write
Runs immediately after a EHLO has been issued .