TYPO3  7.6
LoginAuthenticator.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of SwiftMailer.
5  * (c) 2004-2009 Chris Corbyn
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10 
17 {
23  public function getAuthKeyword()
24  {
25  return 'LOGIN';
26  }
27 
37  public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
38  {
39  try {
40  $agent->executeCommand("AUTH LOGIN\r\n", array(334));
41  $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), array(334));
42  $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), array(235));
43 
44  return true;
45  } catch (Swift_TransportException $e) {
46  $agent->executeCommand("RSET\r\n", array(250));
47 
48  return false;
49  }
50  }
51 }