public function afterEhlo(Swift_Transport_SmtpAgent $agent)
{
if ($this->_username) {
$count = 0;
foreach ($this->_getAuthenticatorsForAgent() as $authenticator) {
if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->_esmtpParams))) {
++$count;
if ($authenticator->authenticate($agent, $this->_username, $this->_password)) {
return;
}
}
}
throw new Swift_TransportException('Failed to authenticate on SMTP server with username "' . $this->_username . '" using ' . $count . ' possible authenticators');
}
}